Why android:background doesn't work for me?
-
my layout file as bellow <?xml version="1.0" encoding="UTF-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".LimeText" > <TextView android:id="@+id/file_title" android:layout_width="fill_parent" android:layout_height="wrap_content" ***android:background="@color/red"*** android:text="@string/untitled" /> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fadingEdge="none"> <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/file_content" ***android:background="@android:color/white"*** android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dip" android:fadingEdge="none" android:scrollbars="vertical|horizontal" android:gravity="top" android:autoText="false" android:capitalize="none" /> </ScrollView></LinearLayout> but no matter how do I change the background, the EditText's background always stay on black and the 'TextView's background always be grey. the grey TextView is set before, #CCCCCC, but now I want to change it to another color, it cannot.
-
Answer:
If you are using this format to set color, make sure that you add relevant values to strings.xml file also. But I'll suggest using the below mentioned format as you dont need to do anything else then: android:background="@android:color/red" The color resource is offered by android framework itself and this is the best way to use android provided resources in the layouts of your apps.
Akash Verma at Quora Visit the source
Related Q & A:
- How come CD doesn't work in my shell script?Best solution by Super User
- Youtube doesn't work on iphone?Best solution by answers.yahoo.com
- Google doesn't work (google.com) on any computer?Best solution by Yahoo! Answers
- Yahoo Music Doesn't Work?Best solution by Yahoo! Answers
- Mail search doesn't work?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.