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

前端 未结 8 2445
一生所求
一生所求 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);
    

提交回复
热议问题