2015-08-03 197 views
1

我使用android:background更改了我的活動的背景顏色。背景顏色改變,但按鈕背景的顏色也改變。我想保留具有默認背景和屬性的按鈕。由於背景顏色而改變了按鈕顏色

按鈕外觀如圖所示。活動的

Button looks like this

XML文件低於

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="#116493"> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     style="?android:attr/buttonStyleSmall" 
     android:text="Button" /> 

</LinearLayout> 
+1

只需設置你的按鈕的背景。問題解決了 – Amsheer

+0

@Nimit,很高興聽到。 –

回答

1

@Nimit AGGARWAL:請更新您的主題設置。刪除style="?android:attr/buttonStyleSmall"。 添加button

<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/your_image" 
    android:text="Button" /> 

爲了演示目的,請按照Android ImageButton selector example

+0

更新主題設置以獲取帶背景的默認按鈕? @IntelliJ Amiya –

+0

http://stackoverflow.com/questions/13222858/android-default-button-style –

+0

哪個主題適用於默認按鈕? –