读书人

linearlayout背景白色元素的字体却成

发布时间: 2013-11-29 13:49:33 作者: rapoo

linearlayout背景白色,元素的字体却成灰色
我需要得到白色背景和黑色字体,却发现如题所说,具体布局如下:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical" >

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip" >

<ImageButton
android:id="@+id/searchBtn"
android:layout_width="50dip"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:scaleType="centerInside"
android:src="@drawable/search" />

<EditText
android:id="@+id/searchText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="0dip"
android:layout_toLeftOf="@id/searchBtn"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="请输入关键字"
android:selectAllOnFocus="true"
android:singleLine="true" />
</RelativeLayout>

<ListView
android:id="@+id/searchList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000" />

</LinearLayout>

发现EditText和ListView的字体成灰色而不是我要的黑色,如果去掉LinearLayout的android:background="#FFFFFF",则当前所在的主题AppTheme,为背景黑色。如何解决才能得到我要的黑色字体?
[解决办法]
android:hint="请输入关键字"
android:cacheColorHint="#00000000"你设置的就是灰色hint默认的

读书人网 >Android

热点推荐