2015-08-03 252 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

哪个主题适用于默认按钮? –