Framelayout又称作帧布局,主要用于进行层次结构的布局,这种布局没有方便的定位方式。想把两个组件叠加到一起形成一张图像的效果就可以用FrameLayout。
如:在图片中添加文字
<FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@mipmap/img_files" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:layout_marginBottom="20dp" android:text="Files" android:textColor="@color/white" android:textSize="20sp" /> </FrameLayout>
