Android Theme Issue using AlertDialog.Builder

亡梦爱人 提交于 2019-12-12 03:29:57

问题


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

Everything is perfect on Nexus 5 which is running 6.0.

Please take a look at the screenshot:

Samsung TAB running 4.4

Nexus 5 running 6.0

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);

回答1:


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>


来源:https://stackoverflow.com/questions/36347659/android-theme-issue-using-alertdialog-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!