Android-布局之FrameLayout
2016-03-26 20:55
405 查看
Android-布局之FrameLayout
安卓有五大布局线性布局,相对布局,绝对布局,表格布局,还有帧布局,其实我对帧布局不是很熟悉,所以特此来复习一下。
frame_layout.xml
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/id_tv1" android:layout_width="300dp" android:layout_height="300dp" android:layout_gravity="center" android:background="#123456" android:text="第一个页面" /> <TextView android:id="@+id/id_tv2" android:layout_width="250dp" android:layout_height="250dp" android:layout_gravity="center" android:background="#456789" android:text="第二个页面" /> <TextView android:id="@+id/id_tv3" android:layout_width="200dp" android:layout_height="200dp" android:layout_gravity="center" android:background="#452289" android:text="第三个页面" /> <TextView android:id="@+id/id_tv4" android:layout_width="150dp" android:layout_height="150dp" android:layout_gravity="center" android:background="#458889" android:text="第四个页面" /> </FrameLayout>
效果:
另外,在App下载东西的时候,我们可以使用这个布局。
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ProgressBar android:layout_gravity="center" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="visible"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="80%" android:textSize="10dp" android:layout_gravity="center"/> </FrameLayout>
运行效果:
相关文章推荐
- android之Androidstudio下查找sha1
- 安卓 jni 开发错误 UnsatisfiedLinkError: Native method not found
- Android Studio 下安卓 jni 开发错误 undefined reference to AndroidBitmap_getInfo
- Android应用界面开发_学习笔记_第四周
- Android开源库
- Android之自定义属性
- android Studio 使用技巧
- android中MVP模式的小案例(一)
- android中惯用的颜色值
- android系统编译kernel时出错:file not recognized: File truncated
- android表情Gson EditText TextView
- Android RecyclerView 使用完全解析
- 查看Android版本的源代码
- android调用第三方api实现用户数授权登录机制详解
- Android SharePreferences的学习笔记
- QtAndroid具体解释(6):集成信鸽推送
- Dagger2在AndroidStudio中的应用以及MVP
- Android SingleTask跨任务栈调用
- 关于Adapter和ViewHolder的另类写法
- Android在程序中使用界面