2011-11-13 74 views
0

我正在使用線性設計歌曲列表屏幕,在底部的線性佈局內部有一個相對佈局應該看起來像在圖像附件中,任何建議我怎樣才能圓底一個相對佈局,以及如何使用漸變顏色,因爲它附在圖像中顯示?從底部繞回相對佈局

enter image description here

+0

爲什麼不只是把圖片作爲背景與彎曲的底部 – blessenm

+0

@ blessenm是好的,如果我使用同樣大小的屏幕,但它造成的問題時,針對不同的設備.thanks屏幕的大小變化。 。 。 – aftab

回答

1

閱讀您可以使用相對佈局和爲四捨五入相對佈局使用背景圖片..

<RelatvieLayout> 
android:id="@+id/relative" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/curvebackground" 
android:alignparent_bottom="true"> 

<ImageView 
    android:id="@+id/imageview" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="" // here source of the imageview 
    android:align_parentLeft="true"/> 
<TextView 
    android:id="@+id/textview" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:align_centerInParent="true"/> 
<Button 
    android:id="@+id/button" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:align_parentRight="true" 
/> 
</RelativeLayout> 

編輯:

在相對佈局中添加這些行,以便它可以正確讀取到相應的屏幕寬度。

android:layout_alignParentBottom="true" 
android:layout_alignParentRight="true" 
android:layout_alignParentLeft="true" 
+0

你是對的。但是當我添加像EditText這樣的組件時,按鈕等來自該背景之外。 – aftab

+0

笏來到外面?即背景是不是全寬?如果是這樣的話,嘗試在相對佈局中添加一些行..檢查我的答案.. – deepa

+0

是的,它很好,現在工作。 。 。 。 – aftab

0

只使用一個彎曲的背景 - 修改佈局的OnDraw似乎對你太大材小用問題。 使用相對大小屏幕上的弧形背景,你可能需要在9-patch