2017-01-10 19 views
0

アクションバーテキスト、ハンバーガーアイコン、アクションバーのオーバーフローアイコンの色を変更する必要があります。私は、次のことを試してみました: -アクションバーの色のみを変更するには?

<!-- Title text --> 
    <item name="android:textColorPrimary">@android:color/white</item> 

    <!-- Title color in AppCompat.Light --> 
    <item name="android:textColorPrimaryInverse">@android:color/white</item> 

    <!-- Menu text--> 
    <item name="actionMenuTextColor">@android:color/white</item> 
    <!-- Overflow --> 
    <item name="android:textColorSecondary">@android:color/white</item> 
    <!-- This will change drawer icon --> 

    <item name="android:popupBackground">@android:color/white</item> 

しかし、オーバーレイポップアップのような他の多くの場所、上記のコードを強制的に色の変化、エディットテキストテキストカラー、一人で所望の場所に色を変更する方法はありますか?

Spannable text = new SpannableString(actionBar.getTitle()); 
    text.setSpan(new ForegroundColorSpan(Color.BLUE), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); 
    actionBar.setTitle(text); 

ちょうどこのようなあなたのアクションバーでカスタムビューを2.Setting:

+0

http://stackoverflow.com/questions/33698122/android-change-actionbar-title-text-colorこれはあなたを助けるかもしれません。 –

答えて

0

はちょうどこのようにアクションバーで

1.Settingテキスト形式のタイトルの前景色を変更するための3方法があります:コードの完全な

ActionBar actionbar = getActionBar(); 
TextView textview = new TextView(MainActivity.this); 

layoutparams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 

textview.setLayoutParams(layoutparams); 
textview.setText("Action Bar Title Text"); 
textview.setGravity(Gravity.CENTER); 
textview.setTextColor(Color.parseColor("#fc6902")); 
textview.setTextSize(25); 

actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 

actionbar.setCustomView(textview); 

ですthere

htmlタグを使用して3.Changingテキストカラー

getSupportActionBar().setTitle((Html.fromHtml("<font color=\"#FF4444\">" + getString(R.string.some_string) + "</font>"))); 
+0

私はこれを知っていますが、ナビゲーション・ドロワーのハンバーガー・アイコンの色を変更したいと思います。オーバーフロー・アイコンの色を変更したいと思います。 –

関連する問題