布局就是一个图片是红点 上面是layout 点击红点控制layout隐藏显示
代码:
final CallOut calloutLocation = new CallOut(mapView.getContext()); calloutLocation.setStyle(CalloutAlignment.BOTTOM); calloutLocation.setLocation(pt.getX(), pt.getY() + 0.1); calloutLocation.setCustomize(true); // 设置自定义背景 LayoutInflater lfCallOut = getLayoutInflater(); View calloutLayout = lfCallOut.inflate(R.layout.callout_wljd, null); TextView wuji_name = calloutLayout.findViewById(R.id.wuji_name); View xq = calloutLayout.findViewById(R.id.xq); View left = calloutLayout.findViewById(R.id.left); left.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { webviewzhushi.loadUrl("https://www.baidu.com/"); rl_webviewzhushi.setVisibility(View.VISIBLE); } }); xq.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showWLJDRightMsg(jsonListObject.get(finalI)); } }); wuji_name.setText(jsonListObject.get(finalI).getWlName()); calloutLocation.setStyle(CalloutAlignment.BOTTOM); calloutLocation.setContentView(calloutLayout);
布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="300dp" android:layout_height="wrap_content" android:divider="@drawable/divider_horizontal_bg" android:gravity="center_horizontal" android:orientation="vertical"> <com.map.mylibrary.utils.BubbleLayout android:id="@+id/view2" android:layout_width="300dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal" android:padding="6dp" android:visibility="gone" app:background_color="#fff" app:radius="4dp" app:shadow_color="#999999"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="5dp" android:text="详情" android:textColor="#666666" /> <TextView android:id="@+id/ed_bj" android:layout_width="match_parent" android:layout_height="80dp" android:layout_gravity="center" android:layout_margin="10dp" android:background="@drawable/shape_xk" android:gravity="center" android:hint="填写描述信息" android:textColor="@color/black" android:textSize="14sp" /> <LinearLayout android:id="@+id/view1" android:layout_width="300dp" android:layout_height="100dp" android:background="@color/white" android:orientation="horizontal" android:padding="10dp" android:visibility="gone"> <!-- <com.example.cdlandrealestate.photoview.photo.MyGridView--> <!-- android:id="@+id/gridview"--> <!-- android:layout_width="match_parent"--> <!-- android:layout_height="wrap_content"--> <!-- android:horizontalSpacing="16px"--> <!-- android:listSelector="@android:color/white"--> <!-- android:numColumns="3"--> <!-- android:scrollbars="none"--> <!-- android:verticalSpacing="16px"--> <!-- android:visibility="visible" />--> <ImageView android:id="@+id/iv1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center" android:layout_weight="1" /> <ImageView android:id="@+id/iv2" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center" android:layout_weight="1" /> <ImageView android:id="@+id/iv3" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center" android:layout_weight="1" /> </LinearLayout> </LinearLayout> </com.map.mylibrary.utils.BubbleLayout> <ImageView android:id="@+id/iv_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:src="@mipmap/wentixiangqing4" /> </LinearLayout>