2011-03-28 23 views
0
查看

我需要製作一個如圖所示的自定義視圖,它需要像單選按鈕一樣的功能,需要選擇任何選項。我怎樣才能做到這一點?我不想使用一系列按鈕。定製在android/

enter image description here

+0

我想,你可以從這裏開始:http://developer.android.com/guide/topics/ui/custom-components.html – mudit 2011-03-28 10:35:38

+0

嘗試TabHost ..你可以看到tabhost的例子[here](http: //www.androidpeople.com/android-tabhost-tutorial-part-1 /)... – 2011-03-28 12:32:01

回答

0

您可以使用RadioGroup中和單選按鈕來實現這一目標。例如,

<RadioButton 
android:id="@+id/custom_btn" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="1" 
android:button="@null" 
android:background="@drawable/button_custom"/> 

其中button_custom是所示按鈕的背景圖像。這個圖像應該有所有的變化(如正常,按下,啓用,禁用,選擇)。