fro*_*tto 5 android android-dialog
我已经创建了自己的自定义对话框,它工作正常,但我想将灰色背景更改为自定义图案(例如图像文件或xml形状).我怎样才能做到这一点?
请注意,我不想改变调光强度,但我只想要,这种调光可以用图案代替
我找到了解决此问题的方法,我从 @vipul mittal 答案中得出此问题,
我应该将对话框主题设置如下:
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
Run Code Online (Sandbox Code Playgroud)
对于这个主题,我的对话将是:
windowIsFloating设置为falsewindowBackground设置为@android:color/transparent现在我应该用一个扮演周围区域角色的包装器来包装我的对话框 xml 布局内容,在本例中我选择了FrameLayout这个:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/dialog_back"> <!-- this is surrounding area drawable -->
<!-- dialog contents goes here -->
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的最终对话框的屏幕截图:

| 归档时间: |
|
| 查看次数: |
2758 次 |
| 最近记录: |