android开发分享Android开发中进行相对布局实例

<?xml version=”1.0″ encoding=”utf-8″?><RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=.

Android开发中进行相对布局实例

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="https://schemas.android.com/apk/res/android" xmlns:app="https://schemas.android.com/apk/res-auto" xmlns:tools="https://schemas.android.com/tools" 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="#000000" /> <View android:id="@+id/view_2" android:layout_width="100dp" android:layout_height="100dp" android:background="#ccff66" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" /> <!--    layout_alignParent+方向:对齐(如上面是向下,向右对齐)--> <View android:id="@+id/view_3" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF0033" android:layout_toRightOf="@id/view_1" /> <!--    layout_toRightOf(在某一view的右侧),layout_below是在下边--> <LinearLayout android:id="@+id/ll_1" android:layout_width="match_parent" android:layout_height="200dp" android:layout_below="@id/view_1" android:orientation="horizontal" android:background="#0066FF" android:padding="15dp"> <View android:layout_width="100dp" android:layout_height="match_parent" android:background="#FF0033"/> <!--        内边距padding15dp--> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" android:padding="15dp"> <View android:id="@+id/view_4" android:layout_width="100dp" android:layout_height="match_parent" android:background="#FF9900"/> <View android:id="@+id/view_5" android:layout_width="100dp" android:layout_height="match_parent" android:layout_marginLeft="10dp" android:layout_toRightOf="@id/view_4" android:background="#FF9900" /> </RelativeLayout> </LinearLayout> </RelativeLayout> 

Android开发中进行相对布局实例

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/addevelopment/894872.html

(0)
上一篇 2021年10月21日
下一篇 2021年10月21日

精彩推荐