当前位置: 代码迷 >> Android >> linearlayout背景白色,元素的字体却成灰色解决方案
  详细解决方案

linearlayout背景白色,元素的字体却成灰色解决方案

热度:20   发布时间:2016-04-28 07:15:46.0
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默认的
  相关解决方案