控件布局_FrameLayout(网格布局)
16lz
2021-01-23
1 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 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 tools:context=".MainActivity" >10 11 <ImageView12 android:id="@+id/ImageView1Id"13 android:layout_width="fill_parent"14 android:layout_height="match_parent"15 android:src="@drawable/feng"16 />17 18 <ImageView19 android:id="@+id/ImageView2Id"20 android:layout_width="50dp"21 android:layout_height="50dp"22 android:layout_gravity="center"23 android:src="@drawable/jian"24 />25 26 </FrameLayout>
网格布局也称为框架布局是最简单的布局方式、所有添加到这个布局中的视图都是以层叠的方式显示。第一个添加到框架布局中的视图显示在最底层,最后一个被放在最顶层,上一层的视图会覆盖下一层的视图,因此框架布局类似堆栈布局。
属性值 | 描述 |
top | 将视图放到屏幕的顶端 |
Buttom | 将视图放到屏幕的底端 |
Left | 将视图放在屏幕的左侧 |
Right | 将视图放在屏幕的右侧 |
Center_vertical | 将视图按照垂直方向居中显示 |
horizontal_vertical | 将视图按照水平方向居中显示 |
更多相关文章
- listView显示多种布局 android
- Android Animation 为布局添加动画效果
- android 开发 RecyclerView 横排列列表布局
- android 获取屏幕宽高、密度、dpi
- 增加滚动布局
- Android Studio——Android获取屏幕宽度的4种方法
- Android 四大组件+五大布局