文字百分比

时间:2014-03-08 14:35:36

标签: android eclipse text percentage

我把这个代码,但百分比的问题给了我一个警告,我应该把它们放在哪里?

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3">
</RelativeLayout>
<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="14">
</RelativeLayout>
<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3">
</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

尝试如下......

<?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="20" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="3"
        android:background="#FF00FF" >
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="14"
        android:background="#FFFF00" >
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="3"
        android:background="#00FFFF" >
    </RelativeLayout>

</LinearLayout>