android中的帧布局(frameLayout)

来源:互联网 发布:西方记者知乎 编辑:程序博客网 时间:2024/05/20 21:45

frameLayout的特点:

所有的子元素都默认放在这块区域的左上角,可以通过android:layout_gravity=" "语句改变控件在布局中的位置。后面的子元素会覆盖前面的子元素。

</pre>例:<pre name="code" class="html"><?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"        android:id="@+id/progressBar1"        style="?android:attr/progressBarStyleLarge"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />    <TextView        android:layout_gravity="center"        android:id="@+id/textView1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="100%" /></FrameLayout>



0 0