0
点赞
收藏
分享

微信扫一扫

Android(五):FrameLayout 帧布局


示例

Android(五):FrameLayout 帧布局_帧布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/mini_logo"
android:foregroundGravity="top|left">

<!--背景-->
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/bg"
android:scaleType="centerCrop"/>

<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FF6143" />

<TextView
android:layout_width="150dp"
android:layout_height="150dp"
android:background="#7BFE00" />

<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FFFF00" />

</FrameLayout>

属性

属性

描述

​background​

设置背景,图片会被拉伸变形

​foreground​

设置改帧布局容器的前景图像,图片不会被拉伸,覆盖所有子元素

​foregroundGravity​

设置前景图像显示的位置,可对图片进行拉伸(​​top|bottom|left|right​​)

⚠️ 左右拉伸高度为原始图片高度不变,上下拉伸宽度为原始宽度不变


举报

相关推荐

0 条评论