我正在尝试更改位于Android操作栏searchview小部件中的drawable.
目前它看起来像这样:

但我需要将蓝色背景改为红色.
我尝试过很多东西,不用滚动我自己的搜索小部件,但似乎没有任何工作.
有人能指出我改变这个方向的正确方向吗?
android styles android-actionbar searchview background-drawable
我在Honeycomb操作栏中放置了一个Android AutoCompleteTextView.问题是即使AutoCompleteTextView具有焦点,它也不显示光标,因此最终用户认为该框没有焦点.
我想在Actionbar 的SearchView中更改闪烁光标的颜色(我使用Actionbar Sherlock来兼容).到目前为止,我已经设法改变了EditText元素的光标颜色.这个SO帖子帮助我完成了这个,我用于EditText的样式如下所示:
<style name="CustomTheme" parent="Theme.Sherlock.Light">
<item name="android:editTextStyle">@style/edittext_style</item>
</style>
<style name="edittext_style" parent="@android:style/Widget.EditText">
<item name="android:textCursorDrawable">@drawable/red_cursor</item>
</style>
Run Code Online (Sandbox Code Playgroud)
红色光标看起来像这样:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient android:startColor="@color/darkRed"
android:endColor="@color/darkRed" />
<size android:width="1dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我确实看了一下SearchView小部件的实现,虽然它使用AutoCompleteTextView进行文本输入.由于AutoCompleteTextView是从EditText小部件派生的,我不太明白为什么样式适用于EditText而不适用于AutoCompleteTextView(因此也适用于SearchView).
有没有人设法改变SearchView小部件中光标的颜色?