从对话中删除边框,填充 [英] remove border, padding from Dialog

查看:120
本文介绍了从对话中删除边框,填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个活动是与主题Theme.Transparent是:

I have an activity which is with the theme Theme.Transparent which is:

<style name="Theme.Transparent" parent="android:Theme.Dialog">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowNoTitle">false</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
    <item name="android:gravity">top</item>
</style>

我试图摆脱边框和它周围的填充..我想使填充屏幕的水平。没有灰色边框。 请帮忙 :)

i'm trying to get rid of the border and the padding around it.. i want to make fill the horizontal of the screen. and no gray border. please help :)

推荐答案

请确保创建对话框引用您的自定义主题:

Be sure to create your Dialog referencing your custom theme:

Dialog dialog = new Dialog(this, R.style.MyDialogTheme);

您的自定义主题需要填充屏幕,并禁止一对夫妇的<一href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml">Android框架默认的:

Your custom theme needs to fill the screen and disable a couple of Android framework defaults:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyDialogTheme" parent="android:Theme.Dialog">
        <!-- Fill the screen -->
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">fill_parent</item>

        <!-- No backgrounds, titles or window float -->
        <item name="android:windowBackground">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">false</item>      

        <!-- Just to prove it's working -->
        <item name="android:background">#ff0000</item>
    </style>

</resources>

这篇关于从对话中删除边框,填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆