2013-04-11 61 views
0

有沒有辦法像日期選擇器對話框中那樣創建加號和減號按鈕? 我的意思是沒有從頭開始創建它們。創建加號和減號按鈕,如日期選擇器

預先感謝您。

+1

是帶按鈕和顯示加/減的背景進去。 – 2013-04-11 07:18:57

+0

是的,但我必須創建一個新的drawable。我認爲在android.R包中有可繪製的加號按鈕,或類似的東西。 – 2013-04-11 07:20:36

+0

@DanieleVitali你是對的有一套你可以使用從android.R.drawable – Raghunandan 2013-04-11 19:33:28

回答

1

一種選擇是做帕雷什mayani建議。

您可以使用android資源可用設置您的按鈕的背景。 Datapicker使用箭頭向上和箭頭向下可用資源(android.R.drawable)。除了創建自定義圖像並將其設置爲按鈕背景之外,您可以使用可用的圖像。對於您可以使用所有的Android繪項目的名單是在下面

http://developer.android.com/reference/android/R.drawable.html

的鏈接可設置背景編程

Button b= (Button) findViewById(R.id.button1); 
b.setBackgroundResource(android.R.drawable.arrow_up_float); 

設置背景XML

<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@android:drawable/arrow_up_float" 
    /> 
相關問題