Jesusrz001
Jesusrz001

Reputation: 85

Change theme for a specific item in a fragment

I have a program which uses the "android:Theme.Holo" for the fragment. Is there a way to lower the theme for an editText to android:Theme ? I tried to do this

<EditText
            android:id="@+id/edit_text"
            android:layout_width="100dp"
            android:layout_height="50dp"
            style="@android:style/android:Theme"
            android:layout_toRightOf="@+id/edit_text_d"
            >
        </EditText>

in the hopes that the edit text would look like the old background of white. I don't want to use a custom background but is this possible?

Upvotes: 0

Views: 370

Answers (1)

Farouk Touzi
Farouk Touzi

Reputation: 3456

You can add this in your Theme:

<style name="myTheme"  parent="android:Theme.Holo">
    <item name="editTextStyle">@style/MyWidget.EditText</item>
</style>

<style name="MyWidget.EditText" parent="android:Widget.EditText">
    <item name="android:background">@drawable/edit_text</item>
 </style>

Upvotes: 1

Related Questions