user3746732
user3746732

Reputation: 11

Background color of the layout automatically changed to white

I have used this color: #7A96A0 in many places in my application. Everything looks fine. But sometimes when I change screen or swipe, background color of the layout is automatically changed to white.This is happening in my entire application. And it happens only for this color. Is something wrong with this color code. I have given the background to the layout in Xml file. is anyone facing similar problem. Thanks in Advance..

Upvotes: 0

Views: 618

Answers (2)

Ashkan
Ashkan

Reputation: 1378

i have same problem whit one of my app change your background source and link it to a shape like this:

shape: shape_sample.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
    <solid android:color="@android:color/white" />
</shape>

and in your layout layout: my_layout.xml

<TextBox
   android:id="@+id/my_item_textView"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:background="@drawable/shape_sample" />

it work for me, i hope it help to you.

Upvotes: 0

user3801157
user3801157

Reputation:

there is no problem with the color code, "#7a96a0" is a valid color code. I think u should add value and name in color property in strings.xml, then use it in your android xml.

go to res >> values >> strings.xml

then add

<color name="colour">#7a96a0</color>

in strings.xml

after that go to xml files and add

<android:background="@color/colour">

wherever you want to use that color .

Hope this helps

Upvotes: 1

Related Questions