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.
Your color code file must be on this path.
res/values/colors.xml
with following content
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="edittext_color">#000000</color>
<color name="text_color">#00FFFF</color>
</resources>
and now use that in such a way.
<EditText
android:id="@+id/my_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="5"
android:background="@color/edittext_color" />
Hope this helps.
Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.