2012-05-25 9 views

答えて

3

これはあなたのアクションバーのためのいくつかのスタイルを設定することによって行うことができます。それはこのブログ記事で説明されていますhttp://android-developers.blogspot.com.au/2011/04/customizing-action-bar.html

あなたのためにあなたのスタイルでこれを設定する必要があります。

<style name="MyTheme" parent="android:style/Theme.Holo.Light"> 
    <item name="android:dropDownListViewStyle">@style/MyDropDownListView</item> 
</style> 

次に、このスタイルを独自のテキストカラーで指定できます。

あなたが SpannableString代わりの Stringを使用することにより、容易 MenuItemテキストの色を変更することができます
<!-- style the items within the overflow menu --> 
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown"> 
    <!-- This is the orange text color --> 
    <item name="android:textColor">#CC3232</item> 
</style> 
+3

これは実際に私にとっては役に立ちません。 DropDown Itemにはバックグラウンドセレクタしかありません。 – redestructa

+0

私のために働く!私は実際にXamarin Androidで開発しています。私はこのソリューションをどこからでも探しています。無数のGoogleの検索の後、私はついにこれにつまずいて試して、それは魅力のように働いた。あなたはそのサブメニューが最終的に青い笑いをどのように感じるかを知りません。 – TeamChillshot

-1

この変化なしの、textColor、のみBackgorund色

1

@Override 
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 
    inflater.inflate(R.menu.your_menu, menu); 

    int positionOfMenuItem = 0; // or whatever... 
    MenuItem item = menu.getItem(positionOfMenuItem); 
    SpannableString s = new SpannableString("My red MenuItem"); 
    s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0); 
    item.setTitle(s); 
} 
関連する問題