Android studio 第二次作业

作业要求:

作一个显示框里面分成三行

一二行占这个框的1/2

第三行独占1/2

第三行里面分成两列第一列占25%,第二列占75%。

屏幕显示效果

实现步骤:

 

 <LinearLayout
android:orientation="vertical"注意这里是横向布局
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.50"这里是设置前两个控件占整个布局的1/2,
android:weightSum="1">


<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="第一行"设置气显示内容
android:id="@+id/textView"
android:layout_gravity="center_horizontal"
android:background="#70DBDB"设置所显示的颜色
android:layout_weight="0.50"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="第二行"
android:id="@+id/textView2"
android:layout_gravity="center_horizontal"
android:background="#32CD99"
android:layout_weight="0.50"
/>
</LinearLayout>

<LinearLayout
android:orientation="horizontal"第二个的布局为纵向布局
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.50"
android:weightSum="1">

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="第一列"
android:id="@+id/textView3"
android:layout_weight="0.25"
android:background="#3232CD"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="第二列"
android:id="@+id/textView4"
android:background="#4D4DFF"
android:layout_weight="0.75"/>
</LinearLayout>
</LinearLayout>

 

转载于:https://www.cnblogs.com/Silence213/p/5999819.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值