开发者

Android Alert Dialog coloring is off

开发者 https://www.devze.com 2023-02-10 09:26 出处:网络
I am creating an alert dialog with Android with this code: AlertDialog ad = new AlertDialog.Builder(self)

I am creating an alert dialog with Android with this code:

            AlertDialog ad = new AlertDialog.Builder(self)
                .setTitle("Invalid Input")
                .setMessage("The number you entered is not a real number.")
                .setNeutralButton("OK",
                    new DialogIn开发者_如何学JAVAterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which){}
                }
                ).show();

I also have an application theme that looks like this:

<style name="CustomTheme" parent="@android:style/Theme.NoTitleBar">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textColor">#222222</item>
    <item name="android:background">#DDDDDD</item>
</style>

As you can see, I'm not theming the dialog or changing it's colors, but it shows up very strangely.

It looks like this:

Android Alert Dialog coloring is off

Does anyone know how to make it appear more normal?


The first thing I'm noticing is that it looks as if your program is running on an old emulator (version 1.5 maybe?). Older versions of the SDK (the one you're running appears to be v. 4) have different default styles for items like alterboxes and toasts. If you were to run the same code in a newer emulator (Say v. 2.2/API 8) the output would look something like this:

http://i.stack.imgur.com/vGIaq.png

Is that what you were asking, or were you trying to manually change the appearance?

0

精彩评论

暂无评论...
验证码 换一张
取 消