Nimit Aggarwal
Nimit Aggarwal

Reputation: 135

Button color changed due to background color

I changed background color of my activity using android:background. Background color changes but color of button background changes too. I want to keep button with default background and properties.

Button looks like as shown in this image.

Button looks like this

XML file of Activity is below

<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>

Upvotes: 1

Views: 61

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75798

@Nimit Aggarwal: Please update your theme settings . Remove style="?android:attr/buttonStyleSmall" . Add button

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

For demo purpose please follow Android ImageButton selector example

Upvotes: 1

Related Questions