Question

I want to remove an editText default transparency which I saw on android 4.
I already tried to solve the problem with alpha=1 on styles in v11 and v14 folders.
But that's not working.

This is my styles.xml :

<resources>

<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
    <!-- API 11 theme customizations can go here. -->
    <item name="android:editTextStyle">@style/MyEditText</item>
</style>

<style name="MyEditText" parent="android:Widget.EditText">
    <item name="android:alpha">1.0</item>
</style>

(style for API 14 is the same)

Was it helpful?

Solution

You have to change the background drawable. The reason it is transparent is that the Holo theme's edit text background is based on a 9 patch that has a solid underline, while the rest of the area is transparent.

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

You will need to define your own background drawable, which should probably be a state list drawable so it will look different depending on whether it is in focus.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top