Invisible ActionMode item icons in Theme.Sherlock.Light.DarkActionBar

前端 未结 8 2382
一生所求
一生所求 2021-02-13 09:47

When using Theme.Sherlock.Light.DarkActionBar (or Theme.Holo.Light.DarkActionBar, doesn\'t make a difference), the ActionMode (or \"contextual ActionB

相关标签:
8条回答
  • 2021-02-13 10:19

    The solution is to use the ActionBar's context to create the AlertDialog:

    Context themedContext = getActivity().getActionBar().getThemedContext();
    

    Or using ActionBarSherlock/ActionBarCompat:

    Context themedContext = getActivity().getSupportActionBar().getThemedContext();
    

    Then create the AlertDialog using this themed context:

    AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
    
    0 讨论(0)
  • 2021-02-13 10:23

    Add this to your theme:

        <item name="android:actionModeCutDrawable">@drawable/ic_menu_cut_holo_light</item>
        <item name="android:actionModeCopyDrawable">@drawable/ic_menu_copy_holo_light</item>
        <item name="android:actionModePasteDrawable">@drawable/ic_menu_paste_holo_light</item>
        <item name="android:actionModeSelectAllDrawable">@drawable/ic_menu_selectall_holo_light</item>
    

    And then add the necessary drawable resources to your project which can be found here: https://github.com/android/platform_frameworks_base/tree/master/core/res/res

    0 讨论(0)
提交回复
热议问题