首页 > 其他 > 详细

第二次作业

时间:2016-10-29 19:38:08      阅读:267      评论:0      收藏:0      [点我收藏+]

作业要求:

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

一二行占这个框的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>

 

第二次作业

原文:http://www.cnblogs.com/liuchen111/p/6011426.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!