android百度地图 覆盖物弹出层效果
16lz
2021-01-23
一:可以使用Dialog使用悬浮弹出层效果
手机屏幕小一般这种方式更fit
dilog布局文件:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffffff" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#0099ff" > <!-- #d94a4a红色搭配 --> <ImageView android:id="@+id/win_close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/close" /> <TextView android:id="@+id/win_title" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1.05" android:gravity="center" android:text="轮船信息" android:textColor="#ffffff" android:textSize="20sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/default_button" /> </LinearLayout> <TableLayout android:id="@+id/map_shipinfo_table" android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="船舶名称:" android:textColor="#bbbbbb" android:paddingLeft="6dip" android:ems="4" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="BAIYUAN9HAO" android:textColor="#bbbbbb" android:paddingLeft="2dip" android:ems="5" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="船舶类型:" android:textColor="#bbbbbb" android:paddingLeft="6dip" android:ems="4" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="123" android:textColor="#bbbbbb" android:ems="4" /> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="长:" android:textColor="#bbbbbb" android:paddingLeft="6dip" android:ems="4" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="37" android:textColor="#bbbbbb" android:paddingLeft="2dip" android:ems="5" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宽:" android:textColor="#bbbbbb" android:paddingLeft="6dip" android:ems="4" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="123" android:textColor="#bbbbbb" android:ems="4" /> </TableRow> </TableLayout> <TableLayout android:layout_width="match_parent" android:layout_height="50dp" > <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:gravity="left" android:layout_marginTop="12dp" android:paddingRight="5dp" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="船舶轨迹" android:layout_gravity="left" android:textColor="#0033FF" android:layout_marginLeft="6dip" android:ems="9" /> </TableRow> </TableLayout> </LinearLayout>
public class ShipInfoDialog { private Dialog dialog; Activity _mActivitygb;public ShipInfoDialog(final Activity _mActivity,String _shipinfo) {try{dialog = new Dialog(_mActivity, R.style.mask_dialog);final LinearLayout popView = (LinearLayout) LayoutInflater.from(_mActivity).inflate(com.lc.main.R.layout.map_shipinfo_dialogview, null);_mActivitygb = _mActivity;// 关闭按钮ImageView viewClose = (ImageView) popView.findViewById(R.id.win_close);viewClose.setOnClickListener(new OnClickListener() {public void onClick(View v) {hide();}});dialog.setContentView(popView, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));dialog.setFeatureDrawableAlpha(Window.FEATURE_OPTIONS_PANEL, 0);Button setok = (Button) popView.findViewById(R.id.setok);setok.setOnClickListener(new OnClickListener(){public void onClick(View v) {}}); //eidt(_shipinfo,popView,_mActivity);} catch (Exception e) {System.out.println(e);}}}
更多相关文章
- android给view比如layout等添加阴影效果
- imageView动画效果
- android中实现指针滑动的动态效果
- CardView 设置水波纹效果
- Android使用TextView实现跑马灯效果
- TextView属性android:ellipsize实现跑马灯效果
- Android 页面惯性回弹效果,Nested接口接口简单实现。
- Android 碎屏效果 (Crack Screen,击碎屏幕)
- android按钮按下的效果