Android Borderless Dialog

后端 未结 8 1812
囚心锁ツ
囚心锁ツ 2020-12-02 14:29

I have created an AlertDialog using AlertDialog.Builder, but the Dialog border takes up too much space on the screen. How do I remove the border? I have tried using another

相关标签:
8条回答
  • 2020-12-02 15:26

    Using android.R.style.Theme_Translucent_NoTitleBar works if you want the dialog to be full screen. An alternative is to create your own style, like so:

    <style
        name="Theme_Dialog_Translucent"
        parent="android:Theme.Dialog">
        <item
            name="android:windowBackground">@null</item>
    </style>
    
    0 讨论(0)
  • 2020-12-02 15:29

    if you have 2 border you need to use a ContextThemeWrapper, which it will show only one border as you would like :)

    ContextThemeWrapper wrapper = new ContextThemeWrapper(this, android.R.style.Theme_Holo);
    final LayoutInflater inflater = (LayoutInflater) wrapper.getSystemService(LAYOUT_INFLATER_SERVICE);
    AlertDialog.Builder builder = new AlertDialog.Builder(wrapper);
    
    0 讨论(0)
提交回复
热议问题