其实实现悬浮的自定义窗体有很多方法,自定义对话框中,自定义布局均可以实现。自定义活动也是可以的,今天我就介绍一下活动的实现方法。下面来看看详细的介绍:
@Override 保护空白> & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比; & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android " android: layout_width=" match_parent " android: layout_height=" match_parent " android:背景=" @color/白” 面向android:=按怪薄北? LinearLayout & lt; android: layout_width=" match_parent " android: layout_height=" 45 dp "比; & lt; TextView android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_gravity="中心" android: layout_marginLeft=" 20 dp” android:文本="语音球开启方式” android:输入textColor=" @color/bg_black” android: textSize=" 20 dp/比; & lt;/LinearLayout> & lt;视图 android: layout_width=" match_parent " android: layout_height=" 1 dp " android:背景=癅color/forget_password”/比; LinearLayout & lt; android: layout_width=" match_parent " android: layout_height=" match_parent " 面向android:=按怪薄北? LinearLayout & lt; android: id=癅 + id/display_dialog_intelligence_linner” android: layout_width=" match_parent " android: layout_height=" 65 dp” 面向android:="水平"比; & lt; ImageView android: id=癅 + id/display_dialog_intelligence_iv” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_gravity="中心" android: src=" https://www.yisu.com/zixun/@mipmap abc_btn_radio_to_on_mtrl_000 "/比; & lt; TextView android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_gravity="中心" android: layout_marginLeft=" 10 dp” android:文本="智能显示” 输入textColor=癅color/colorGreen2”android:/比; & lt;/LinearLayout> & lt;视图 android: layout_width=" match_parent " android: layout_height=" 1 dp " android:背景=癅color/forget_password”/比; LinearLayout & lt; android: id=癅 + id/display_dialog_custom_linner” android: layout_width=" match_parent " android: layout_height=" 65 dp” 面向android:="水平"比; & lt; ImageView android: id=癅 + id/display_dialog_custom_iv” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_gravity="中心" android: src=" https://www.yisu.com/zixun/@mipmap abc_btn_radio_to_on_mtrl_000 "/比; & lt; TextView android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_gravity="中心" android: layout_marginLeft=" 10 dp” android:文本="自定义显示” 输入textColor=癅color/colorGreen2”android:/比; & lt;/LinearLayout> & lt;/LinearLayout> & lt;/LinearLayout>
风格样式:
& lt;样式名=" activityTheme "父=癅android:风格/Theme.Translucent.NoTitleBar.Fullscreen”比; & lt;项目名称=" android: windowFrame "祝辞@null & lt; !——边框——比; & lt;项目名称=" android: windowIsFloating "祝辞true & lt; !——是否浮现之在活动上——比; & lt;项目名称=" android: windowIsTranslucent "祝辞false & lt; !——半透明——比; & lt;项目名称=" android: windowNoTitle "祝辞true & lt; !——无标题——比; & lt;项目名称=" android:背景”祝辞@android:颜色/transparent & lt;项目名称=" android: windowBackground "祝辞@android:颜色/transparent & lt; !——背景透明——比; & lt;项目名称=" android: backgroundDimEnabled "祝辞true & lt; !——模糊——比; & lt;/style>
资源文件配置活动:
& lt;活动 android: name=" .__activity.FloatWindowDialogActivity " android: screenOrientation=靶は瘛? android:主题=癅style/activityTheme”/祝辞Android通过自定义活动实现悬浮的对话框详解