android 相对布局_【学习】安卓212相对布局的练习含代码版
生活随笔
收集整理的這篇文章主要介紹了
android 相对布局_【学习】安卓212相对布局的练习含代码版
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2-1-2RelativeLayout相對布局
相對布局關鍵就是“相對”是一個方位類型的定位,不是按照找單一的形式排序的。即a可以放在b后面,也可以放在前面,不定的。隨機性高~基本上線性布局有的屬性,它都有。
學習一些屬性的應用。
預覽的視圖如下:
真機運行的截圖
下列為該次實驗代碼,依舊是在
這個xml文件
代碼:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <View android:id="@+id/view_1" android:layout_width="100dp" android:layout_height="100dp" android:background="#100000" /> <View android:layout_width="100dp" android:layout_height="100dp" android:background="#02f122" android:id="@+id/view_2" android:layout_toRightOf="@id/view_1" /> <LinearLayout android:id="@+id/line_1" android:layout_width="match_parent" android:layout_height="300dp" android:background="#1564fd" android:orientation="horizontal" android:layout_below="@id/view_1" android:padding="15dp" > <View android:layout_width="100dp" android:layout_height="match_parent" android:background="#fad" /> <View android:layout_width="100dp" android:layout_height="match_parent" android:background="#adfd" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:padding="15dp" > <View android:id="@+id/view_3" android:layout_width="25dp" android:layout_height="match_parent" android:background="#ff1" /> <View android:layout_width="25dp" android:layout_height="match_parent" android:background="#02f122" android:id="@+id/view_4" android:layout_toRightOf="@id/view_3" android:layout_marginLeft="100dp" /> RelativeLayout> LinearLayout>RelativeLayout>總結
以上是生活随笔為你收集整理的android 相对布局_【学习】安卓212相对布局的练习含代码版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中国人民解放军空军建军节是每年的哪一天
- 下一篇: 俄罗斯铁盒参议院在哪买