English 中文(简体)
Android Alert Dia Dia
原标题:Android Custom Alert Dialog Display Error after changing the Build Version

我正在形成一个简单的词汇。 在这场辩论中,我只是提出一个简单的习俗警报。 罚款。

这表明,在一把应用建设成1.6时,我取得了完美的结果,但当一把roid状物从1.6改成2.2时,它显示了意外的结果。 它没有显示显示习惯警示的背景情况。

Here is my xml file. Custom Dialog Theme File

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CustomDialogTheme" parent="@android:style/AlertDialog">
        <item name="android:windowFrame">@null</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowAnimationStyle">@android:style/Theme.Dialog</item>
    </style>
</resources>

www.un.org/Depts/DGACM/index_spanish.htm 这里是我的习俗组织。

package com.utility.org;

import android.app.Activity;
import android.app.Dialog;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

    public class CustomConfirmOkDialog extends Dialog implements OnClickListener
    {
        private Button okButton = null;
        private TextView infoText=null,confirmBody=null;
        private int errorMessage=0;
        @SuppressWarnings("unused")
        private Activity activity;

        public CustomConfirmOkDialog(Activity context,int customdialogtheme,int errorMessage) 
        {
            super(context,customdialogtheme);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.confirm_ok);
            this.errorMessage = errorMessage;
            this.activity = context;
            initControls();
        }

        private void initControls()
        {
            okButton = (Button) findViewById(R.id.ok_button);
            okButton.setOnClickListener(this);

            infoText = (TextView)findViewById(R.id.infoText);
            confirmBody = (TextView)findViewById(R.id.confirmBody);

            switch (this.errorMessage) 
            {

                case Utility.INVALID_USERNAME_PASSWORD:
                    try
                    {
                        infoText.setText(R.string.signIn);
                        confirmBody.setText(R.string.invalidUsernameAndPassword);
                    }
                    catch (Exception e) 
                    {
                        e.printStackTrace();
                    }
                    break;


                default:
                    break;
            }
        }
        public void onClick(View v) 
        {
            dismiss();
        }
    }

用以下代码将这一类别从我的主要活动中选取。

CustomConfirmOkDialog dialog = new CustomConfirmOkDialog(MainActivity.this, R.style.CustomDialogTheme, Utility.INVALID_USERNAME_PASSWORD);
dialog.show();

enter image description here enter image description here

在这里,你可以清楚地看到,<代码>1st Image显示了背景。 其建筑在海底1.6版,而2nd 图像。 页: 1 它显示了整个黑色屏幕。 其建筑在原状2.2中。 我非常感谢大家能够解决这一问题。

Can anyone help me to solve this simple and silly issue ?

预付款。

最佳回答

它通过修改习俗诊断书Theme xml档案中的以下法典解决了我的问题。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CustomDialogTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
        <item name="android:windowFrame">@null</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>
问题回答

我也面临同样的问题。 问题在于我称之为Dialog阶级的构造者。

Dialog(背景,主题) Id

它将掩盖背景活动。 唯一找到的解决办法并不叫作该建筑商,而只是说话。

Dialog(背景)

在布局档案中树立你的风格。

因此,在你的法典中,只有文字写

超级(文本)

而不是

超级(文本,主题);





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签