没有它衰落的背景下调用Android的对话框 [英] Calling android dialog without it fading the background

查看:101
本文介绍了没有它衰落的背景下调用Android的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样好的对话视图设置我UserInputDialog类:

I have this nice dialog view I set my UserInputDialog class to:

    <LinearLayout android:id="@+id/LinearLayout01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

        <TextView
        android:id="@+id/nameMessage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="What is your name Captain?"
        >
        </TextView>
        <EditText
        android:id="@+id/nameEditText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        >
        </EditText>
    <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="fill_parent" android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal">
    <Button
        android:id="@+id/okButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="OK">
        </Button>
        <Button android:id="@+id/cancelButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Cancel">
        </Button>               
    </LinearLayout>
</LinearLayout>

我希望我的对话框出现,但对于背景没有淡出。这可能吗?原因调用这个对话框有一个NEATO背景我想显示为背景,以对话的看法。

I want my dialog to show up but for the background to not fade out. Is this possible? Cause the view that calls this dialog has a neato background I would like to be shown as a backdrop to the dialog.

我发现这个在线:

<style name="doNotDim" parent="@android:style/Theme.Dialog">
    <item name="android:backgroundDimAmount">0</item>
</style >

但不知道如何应用到我的对话?我有一类叫做公共类UserInputDialog扩展对话框实现OnClickListener 。它会将其内容以上述布局

but not sure how to apply that to my dialog? I have a class called public class UserInputDialog extends Dialog implements OnClickListener. It sets its content view to the layout described above.

我觉得我做的这一切吧,只是不知道如何添加的风格,所以我可以不褪色的背景。

I think I am doing this all right, just not sure how to add that style so I can NOT fade the background.

次级的问题:你能得到新的期待您的对话框上(通过说具有图像或图标显示有文本存在)通过主题

Secondary question: Can you get new looks on your dialog (by say having an image or icon display with your text there) by using Themes?

推荐答案

创建RES /价值/ styles.xml文件,将其添加到它。

Create a res/values/styles.xml file and add this to it.

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.DoNotDim" parent="android:Theme">
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>

和应用的主题为您的活动。

And apply the theme to your activity.

<activity android:name=".SampleActivity" android:theme="@style/Theme.DoNotDim">

这篇关于没有它衰落的背景下调用Android的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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