6

我正在使用 sherlock 操作栏版本 4.1.0 (2012-05-17)。如何更改此屏幕截图中文本颜色的颜色?在实际设备上几乎不可读

在此处输入图像描述

我有这个主题

<style name="MyTheme" parent="@style/Theme.Sherlock.Light">
    <item name="android:textSize">20dp</item> 
</style>

这在 AndroidManifest.xml

<application
        android:name="abc.MyApp"
        android:icon="@drawable/ic_launcher"
        android:logo="@drawable/logo"
        android:label="@string/app_name"
        android:theme="@style/MyTheme" 
        >
4

4 回答 4

3

实际上,通过执行以下操作,我已经设法在 abs 4.2 中设置 SearchView 文本颜色的样式:

<style name="MyTheme" parent="Theme.Sherlock.Light">

    <item name="searchAutoCompleteTextView">@style/Widget.Styled.SearchAutocompleteTextView</item>

    <item name="queryHint">@string/Search</item>
    <item name="android:queryHint">@string/Search</item>


</style>

<style name="Widget.Styled.SearchAutocompleteTextView" parent="Widget.Sherlock.Light.SearchAutoCompleteTextView">
    <item name="android:textColor">YOU_COLOR_HERE</item>

</style>
于 2012-11-27T11:11:04.050 回答
1

我对 Sherlock 没有任何经验,但您是否尝试添加:

<item name="android:textColor">@color/my_color</item>

夏洛克动作栏主题?

然后在你的 values/color.xml 你有颜色:

<color name="my_color">#ff00ff00</color>
于 2012-08-07T09:59:56.183 回答
1

感谢这个答案:更改 searchview 小部件的背景可绘制对象

SearchManager searchManager = (SearchManager) a.getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = new android.widget.SearchView(a.getApplicationContext());
int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
// Getting the 'search_plate' LinearLayout.
AutoCompleteTextView searchPlate = (AutoCompleteTextView) searchView.findViewById(searchPlateId);
// Setting background of 'search_plate' to earlier defined drawable.
searchPlate.setTextColor(Color.BLACK);
...
于 2012-08-07T12:46:11.410 回答
1

用这个,就对了。:D

AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.abs__search_src_text);
searchText.setHintTextColor(getResources().getColor(color.black));
searchText.setTextColor(getResources().getColor(color.black));
于 2013-01-28T10:32:19.113 回答