【问题标题】:Text selection tools in ActionBar are white on white background after selecting text in Dialog在 Dialog 中选择文本后,ActionBar 中的文本选择工具在白色背景上显示为白色
【发布时间】:2015-04-12 03:38:08
【问题描述】:

有人遇到过这个问题,在对话框的 EditText 中选择文本后,工具栏会出现不可见的操作按钮(白底白字)?

如何将主题设置为 DialogFragment?

【问题讨论】:

    标签: android dialog android-actionbar android-dialogfragment textselection


    【解决方案1】:

    您可以在styles.xml中自定义对话框主题:

    <style name="MyDialogTheme" parent="android:Theme.Holo.Dialog" />   
    

    然后在您的DialogFragment 中使用MyDialogTheme


    更新

    在您的对话框中使用以下代码设置自定义主题:

    ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), R.style.MyDialogTheme);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    ... ...
    

    【讨论】:

    • 使用dialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.MyDialogTheme); 设置样式没有任何效果。 :(
    猜你喜欢
    • 2015-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多