I have a simple layout with an edittext.
When I set the background of the EditText
to a color
<EditText
android:id="@+id/et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:color/white" />
Then a strange thing happens when the edittext gains focus, the background color of the layout changes(!).
I need to change the background color dynamically, and I have the same result after calling:
subject.setBackgroundColor(Color.parseColor(mycolor));
I have also tried the following method :
subject.setBackground(new ColorDrawable(Color.parseColor(mycolor)));
The result was the same.
Basically I want to change the background color of an Edittext in runtime.