2012-08-02 118 views
6

我正在使用sherlock操作欄版本4.1.0 (2012-05-17)。 如何更改此截圖中文字顏色的顏色?在實際的設備是barelly可讀Sherlock動作欄更改文字顏色

enter image description here

我有這個主題

<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" 
     > 

回答

1

感謝這個Answer To: Changing the background drawable of the searchview widget

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); 
... 
1

我沒有與任何福爾摩斯經驗,但您是否嘗試加入:

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

以Sherlock動作欄爲主題?

然後在你的價值觀/ color.xml你有顏色:

<color name="my_color">#ff00ff00</color> 
+0

是剛試過,加入myTheme,沒效果 – max4ever 2012-08-07 10:36:47

3

其實我已經成功地將樣式文本搜索查看顏色ABS 4.2通過執行以下操作:

<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> 
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));