【问题标题】:cannot set modal background to transparent in android无法在android中将模态背景设置为透明
【发布时间】:2019-02-11 16:16:16
【问题描述】:

无法将本机脚本模式窗口的背景设置为透明

我在下面的链接中做了一个例子。 https://play.nativescript.org/?template=play-js&id=6xzzC2

<!-- >> modal-view-xml -->
<Page backgroundColor="transparent" xmlns="http://www.nativescript.org/tns.xsd"
    shownModally="onShownModally" height="300" width="250">

    <StackLayout borderRadius="30" backgroundColor="green">
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
        <Label text="android" textWrap="true" />
    </StackLayout>

</Page>
<!-- << modal-view-xml -->

我需要一个带边框的圆形模态窗口

【问题讨论】:

  • iOS 模态窗口默认为全屏,无法修改该行为。如果您仍然喜欢某个模式,您可能必须构建自己的模式,例如 View。
  • @Manoj 很抱歉更不用说我正在尝试使用 android。此代码根本不适用于 android。

标签: modal-dialog nativescript nativescript-telerik-ui


【解决方案1】:

试试这个,

if (page._dialogFragment) {
    page._dialogFragment.getDialog().getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
}

Playground Sample

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-02
    • 1970-01-01
    • 2013-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多