android studio设计线性布,<1>AndroidStudio初体验--布局练习

参考设计图:

80d1ade6633226cc792a6a78bd0f0fdb.png

实验成果:

19860a5338409bd3171a8b4ab32f787c.png

采用了线性布局与相对布局

实验代码:

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:background="#EED2EE"

tools:context=".MainActivity">

//第0层

android:id = "@+id/li_0"

android:layout_width="match_parent"

android:layout_height="50dp"

android:background="@color/white"

android:orientation="horizontal"

android:layout_margin="10dp"

>

//第1层

android:id = "@+id/li_1"

android:layout_width="match_parent"

android:layout_height="150dp"

android:orientation="horizontal"

android:padding="7dp">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_margin="10dp"

android:background="#EE799F" />

//第2层

android:id="@+id/li_2"

android:layout_width="match_parent"

android:layout_height="90dp"

android:orientation="horizontal"

>

android:layout_width="80dp"

android:layout_height="match_parent"

android:background="#BCD2EE"

android:layout_margin="8dp"

/>

android:layout_width="80dp"

android:layout_height="match_parent"

android:background="#BCD2EE"

android:layout_margin="8dp"

/>

android:layout_width="80dp"

android:layout_height="match_parent"

android:background="#BCD2EE"

android:layout_margin="8dp"

/>

android:layout_width="80dp"

android:layout_height="match_parent"

android:background="#BCD2EE"

android:layout_margin="8dp"

/>

>

//第3层

android:id = "@+id/li_3"

android:layout_width="match_parent"

android:layout_height="200dp"

android:padding="7dp">

android:id="@+id/view_1"

android:layout_width="match_parent"

android:layout_height="50dp"

android:background="@color/white"

android:layout_margin="10dp"/>

android:id="@+id/view_2"

android:layout_width="120dp"

android:layout_height="match_parent"

android:background="#66ff33"

android:layout_below="@id/view_1"

android:layout_margin="10dp"/>

android:id="@+id/view_3"

android:layout_width="120dp"

android:layout_height="130dp"

android:background="#66ff33"

android:layout_below="@id/view_1"

android:layout_toRightOf="@id/view_2"

android:layout_margin="10dp"/>

android:layout_width="120dp"

android:layout_height="match_parent"

android:background="#66ff33"

android:layout_below="@id/view_1"

android:layout_toRightOf="@id/view_3"

android:layout_margin="10dp"/>

原文:https://www.cnblogs.com/fefll/p/14728472.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值