2012-08-02 23 views
6

Używam paska akcji sherlock Version 4.1.0 (2012-05-17). Jak mogę zmienić kolor tekstu na tym zrzucie ekranu? Na rzeczywistym urządzeniu jest barelly czytelnyPasek akcji Sherlocka zmienia kolor tekstu

enter image description here

mam ten motyw

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

a to z 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" 
     > 

Odpowiedz

1

Dzięki tej 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

nie mam żadnego doświadczenia z Sherlocka , ale czy próbowałeś dodać:

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

do motywu paska działań Sherlock?

A potem w swojej Wartości/color.xml masz kolor:

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

tak po prostu wypróbowany, dodano do myTheme, brak efektu – max4ever

3

Właściwie udało mi się styl kolor tekstu SearchView w abs 4.2 wykonując następujące czynności:

<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

Użyj tego, to prawda. : D

AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.abs__search_src_text); 
searchText.setHintTextColor(getResources().getColor(color.black)); 
searchText.setTextColor(getResources().getColor(color.black)); 
Powiązane problemy