2010-09-15 80 views
1

我正在設計一個按鈕,其寬度可以通過不同的內容在程序中改變。我從設計師這樣的PNG文件:Android /造型按鈕:背景也在可繪製的左側和可繪製的右側

[Left Border] [Background (just a strip with the gradient)] [Right Border] 

我覺得我很好分配按鈕這樣的性質:

Background: Background.png 
Drawable left: LeftBorder.png 
Drawable right: RightBorder.png 

,但它不應是這樣的;)現在,Background.png開始於可繪製左側開始並在可繪製右側結束時結束。在這種情況下使用這些可繪製屬性不是正確的方法嗎?

這裏是代碼:

<Button 
    android:text="@+id/Button01" 
    android:id="@+id/Button01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:drawableLeft="@drawable/top_loaction_left" 
    android:drawableRight="@drawable/top_loaction_right" 
    android:background="@drawable/top_loaction_bg"></Button> 

..

回答