Android 编辑文本背景色问题
我有一个线性布局,有两个子项,一个编辑文本和按钮。我将线性布局的背景色设置为蓝色。在android api 8上,edittext字段有一个白色背景,这是我想要的,但是在android api 17+上,edittext背景与线性布局相同,因此文本输入有点难以读取,因为它是黑色的 当我将edittext背景从默认值?android:attr/editTextBackground更改为白色ffffff时,edittext的高度会变小,并且不会保持以前的外观。我的问题是,如何在不改变其他属性的情况下将edittext的背景保持为白色?android:attr/editTextBackground在所有api级别都会影响这些属性 而且我也没有弄清楚属性指向哪个文件?android:attr/editTextBackground,所以我可能可以查看并编辑。提前谢谢 守则:Android 编辑文本背景色问题,android,android-edittext,Android,Android Edittext,我有一个线性布局,有两个子项,一个编辑文本和按钮。我将线性布局的背景色设置为蓝色。在android api 8上,edittext字段有一个白色背景,这是我想要的,但是在android api 17+上,edittext背景与线性布局相同,因此文本输入有点难以读取,因为它是黑色的 当我将edittext背景从默认值?android:attr/editTextBackground更改为白色ffffff时,edittext的高度会变小,并且不会保持以前的外观。我的问题是,如何在不改变其他属性的情况下
<LinearLayout
android:id="@+id/llSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/search_layout_color"
android:orientation="horizontal"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="6dp"
android:shadowColor="#77000000"
android:shadowDx="-2.4"
android:shadowDy="2.4"
android:shadowRadius="1.2" >
<EditText
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/hint_search"
android:scrollHorizontally="true"
android:singleLine="true"
android:textSize="@dimen/tv_textSize" >
<requestFocus />
</EditText>
<ImageButton
android:id="@+id/bSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/search"
android:src="@drawable/ic_action_search" />
</LinearLayout>
你能给出edittext的高度吗?我正在跳,我可以找到一个解决方案,用我的自定义颜色包围edittext,而不必像android api 8上显示的那样更改其参数。谢谢你的贡献。