2016-06-29 9 views
0

Wenn ich auf OptionMenüItem auf Toolbar klicke, wird schwarzer Hintergrund angezeigt. Ich erhalte dieses Problem auf kitkat Gerät, seine gut auf Lutscher arbeiten und höhereWenn man auf OptionMenu klickt, wird schwarzer Hintergrund auf kitkat angezeigt

// Toolbar which i am using 

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:local="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="?attr/colorPrimary" 
       android:minHeight="?attr/actionBarSize" 
       local:popupTheme="@style/MyCustomPopUpTheme" 
       local:theme="@style/ToolbarCustomTheme" /> 


    // MyCustomPopUpTheme theme it works correctly 

    <style name="MyCustomPopUpTheme" parent="ThemeOverlay.AppCompat.Light"> 
      <item name="windowNoTitle">true</item> 
      <item name="colorPrimary">@color/colorPrimary</item> 
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
      <item name="colorAccent">@color/colorAccent</item> 
      <item name="actionMenuTextColor">@color/white</item> 
      <item name="android:background">@color/white</item> 
      <!-- item for setting the background color of item selected from the list --> 
      <item name="listChoiceBackgroundIndicator">@color/white</item> 
     </style> 

    // ToolbarCustomTheme theme here i am getting issue extending ThemeOverlay.AppCompat.Dark.ActionBar theme 

    <style name="ToolbarCustomTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> 
      <item name="windowNoTitle">true</item> 
      <item name="colorPrimary">@color/colorPrimary</item> 
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
      <item name="colorAccent">@color/colorAccent</item> 
      <item name="actionMenuTextColor">@color/white</item> 
      <item name="android:background">@color/colorPrimary</item> 
      <item name="background">@color/colorPrimary</item> 
     </style> 

Antwort

0

Versuchen Sie, immer die alpha, wenn die Farben zu definieren. Wenn Sie also rot möchten, definieren Sie #fff0000 statt # ff0000.

Falls Ihre @ color/white eine einfache #ffffff ist, verwenden Sie einfach das vordefinierte @android: color/white. Es gibt ein paar vordefinierte.

Verwandte Themen