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

前端 未结 8 2555
一生所求
一生所求 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:16

    Problem:

    App theme is inherited from android:Theme.Light, and there is no dedicated theme for AlertDialog, so that the ActionMode items are somehow invisible.


    Solution:

    1. Create a dedicated theme for AlertDialog;

    
    
    

    Note: the most important line which makes the magic is @android:color/holo_blue_light

    2. Use the dedicated theme when building an AlertDialog.

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme);
    

    Please have a look at the screenshot which shows before and after applying the theme.

    screenshot

提交回复
热议问题