如何在Android XML分成三个相等的长方形布局? [英] How to split an Android XML into three equal layout rectangles?
本文介绍了如何在Android XML分成三个相等的长方形布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何拆分Android的XML视图分成三个相等的长方形布局像下面的图片?
How do I split an Android XML view into three equal layout rectangles like the image below?
推荐答案
您想使用一个垂直的LinearLayout,像这样的:
You want to use a vertical LinearLayout, like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="3" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#ff0000" >
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#00ff00" >
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#0000ff" >
</FrameLayout>
</LinearLayout>
这篇关于如何在Android XML分成三个相等的长方形布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文