Android帧布局管理器
FrameLayout:帧布局管理器
1、特点:显示层叠的内容,显示拖动的动画效果
2、<FrameLayout>标记
常用属性:
android:foreground:设置前景图像
android:foregroundGravity:设置前景图像的位置(前景图像——位于最上层)
3、实例
1 <?xml version="1.0" encoding="utf-8"?> 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" 4 android:layout_width="match_parent" android:layout_height="match_parent" 5 android:paddingBottom="@dimen/activity_vertical_margin" 6 android:paddingLeft="@dimen/activity_horizontal_margin" 7 android:paddingRight="@dimen/activity_horizontal_margin" 8 android:paddingTop="@dimen/activity_vertical_margin" 9 android:foreground="@mipmap/mla" 10 android:foregroundGravity="left|bottom" 11 tools:context="com.example.action.MainActivity"> 12 13 <TextView 14 android:layout_width="280dp" 15 android:layout_height="280dp" 16 android:layout_gravity="center" 17 android:background="#FF0000FF" 18 android:text="蓝色背景的TextView" 19 android:textColor="#FFFFFF"/> 20 <TextView 21 android:layout_width="230dp" 22 android:layout_height="230dp" 23 android:layout_gravity="center" 24 android:background="#FF0077FF" 25 android:text="天蓝色背景的TextView" 26 android:textColor="#FFFFFF"/> 27 <TextView 28 android:layout_width="180dp" 29 android:layout_height="180dp" 30 android:layout_gravity="center" 31 android:background="#FF00B4FF" 32 android:text="水蓝色背景的TextView" 33 android:textColor="#FFFFFF"/> 34 </FrameLayout>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统