使用AlertDialog.Builder的Android主题问题 [英] Android Theme Issue using AlertDialog.Builder

查看:342
本文介绍了使用AlertDialog.Builder的Android主题问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 4.4版本标签上使用TextInputLayout时,我在Edittext中看不到该行.

I don't see the line in Edittext when using TextInputLayout on Android 4.4 version tabs.

在运行6.0的Nexus 5上,一切都很完美.

Everything is perfect on Nexus 5 which is running 6.0.

请看一下屏幕截图:

运行4.4的三星TAB

运行6.0的Nexus 5

上面是XML,并通过对话框将其打开.我在对话框中打开上述内容:

Above is an XML and opening it throught a dialog. I am opening the above in dialog box something like this:

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, android.R.style.Theme_Material_Light_Dialog));
                alertDialogBuilder.setView(view);

推荐答案

import android.support.v7.app.AlertDialog 

AlertDialog.Builder builder =
       new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
            builder.setTitle("TITLE");
            builder.setMessage("YOUR MESSAGE....");
            builder.setPositiveButton("OK", null);
            builder.setNegativeButton("CANCEL", null);
            builder.show();

style.xml:

    <style name="AppCompatAlertDialogStyle"   parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="colorAccent">#FFCC00</item>
        <item name="android:textColorPrimary">#FFFFFF</item>
        <item name="android:background">#666666</item>
    </style>

这篇关于使用AlertDialog.Builder的Android主题问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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