基本上我改變了我主要活動的3個按鈕的背景。現在,當我點擊按鈕時,它不再像我之前改變背景那樣突出顯示。不知何故背景導致了這個問題。沒有人看起來有相同的問題。難道我做錯了什麼?按鈕不會突出顯示點擊android
NB:該按鈕正常工作,它只是突出顯示沒有。
我對XML代碼:
<Button
android:id="@+id/Contact"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/textView1"
android:layout_alignTop="@+id/linearLayout1"
android:layout_toRightOf="@+id/linearLayout1"
android:background="#f0e68c" //<<Here this background i changed
android:text="@string/Contact" />
<Button
android:id="@+id/Gallery"
style="?android:attr/buttonStyleSmall"
android:layout_width="88dp"
android:layout_height="wrap_content"
android:background="#f0e68c" //<<Here this background i changed
android:text="@string/Gallery" />
</RelativeLayout>
所以以後我改變了這些按鈕的亮點不工作的背景。如果您將其更改回正常,則突出顯示可正常工作。
http://stackoverflow.com/questions/4131656/how-to-make-button-highlight – TronicZomB
你需要使用stateListDrawable作爲背景。 http://developer.android.com/guide/topics/ui/controls/button.html#CustomBackground – Anirudh