旧版Android API上的Apple Style AlertDialog

Ale*_*vin 10 android dialog android-alertdialog android-dialog

我正在研究AndroidRate库的Apple Style AlertDialog功能,无法解决 Android 9-10 API上的一些错误.

  1. 我无法在Android的9-10 API上删除AlertDialog边框

API 19: Android API 19上AndroidRate库的Apple Style AlertDialog API 10: Android API 10上AndroidRate库的Apple Style AlertDialog

  1. 我无法在Android的9-10 API上修复AlertDialog宽度

API 19: Android API 19上AndroidRate库的Apple Style AlertDialog API 10: Android API 10上AndroidRate库的Apple Style AlertDialog

我的style.xml:

<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ // Copyright 2018 Vorlonsoft LLC
  ~ //
  ~ // Licensed under The MIT License (MIT)
-->
<resources>

    <!-- Base Apple and Modern types Rate Dialog theme. -->
    <style name="RateDialogTransparentTheme">
        <item name="android:background">@color/rateDialogColorTransparent</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:backgroundDimAmount">0.4</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowBackground">@color/rateDialogColorTransparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowFrame">@null</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowTitleStyle">@null</item>
    </style>

</resources>
Run Code Online (Sandbox Code Playgroud)

我的layout.xml:

https://github.com/Vorlonsoft/AndroidRate/blob/master/library/src/main/res/layout/rate_dialog.xml

你可以帮帮我吗?

小智 0

您可以尝试以编程方式设置对话框背景

例如:dialog.getWindow().setBackgroundDrawableResource(your_drawable_id(like R.drawable.rounded_corners_white_background_3))