2011-09-16 131 views
0

幫我想這個清單項目佈局我的應用程序 -需要與Android XML佈局

我使用相對佈局LinearLayout中的顏色和TextView的文本,但是,這並不得到期望的結果嘗試。任何人都可以幫忙嗎? 這裏是代碼我已經試過這犯規得到期望的輸出 - 這裏是我曾嘗試代碼 - 這裏是我曾嘗試代碼 -

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:orientation="horizontal" 
android:layout_height="wrap_content"> 

<LinearLayout 
android:layout_width="fill_parent" 
android:orientation="horizontal" 
android:background="#98F5FF" 
android:layout_height="wrap_content" 
> 
</LinearLayout> 

<LinearLayout android:layout_width="fill_parent" 
android:orientation="horizontal" 
android:layout_height="wrap_content"> 
<TextView android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:id="@+id/text1" 
android:textSize="25dip" 
android:textColor="#FFFFFF" 
android:text="This is text1"/> 
</LinearLayout> 

</RelativeLayout> 

listitem

+2

請發佈您的佈局xml並指定到底是什麼問題。 – datalost

回答

0

我會在上面使用RelativeLayout的層次結構中,其底部的第一個佈局(如您所說的背景)和其他3個視圖位於頂部的其餘元素將具有1 LinearLayout。在LinearLayout中,您可以使用android:layout_weight參數設置所需的綠色背景百分比。