简体   繁体   English

在android nativescript上设置背景透明?

[英]set the background transparent on android nativescript?

我想在我的视图中实现这种由警报视图显示的透明度

I want to achieve this kinda transparency on my custom view as displayed by alert view for Android application.我想在我的自定义视图上实现这种透明度,如 Android 应用程序的警报视图所示。 Thanks谢谢

@Dlucidone I had this solved by using custom overlay from css. @Dlucidone 我通过使用来自 css 的自定义覆盖解决了这个问题。

<GridLayout>
    <StackLayout>
        // All your page content goes here! 
    </StackLayout>
    <StackLayout class="dimmer" visibility="{{showLoading ? 'visible' : 'collapsed'}}"/>
    <GridLayout rows="*" visibility="{{showLoading ? 'visible' : 'collapsed'}}">
        <ActivityIndicator busy="true" />
    </GridLayout>
</GridLayout>

Set the dimmer class to background transparent css, with width and height to 100%将dimmer类设置为背景透明的css,宽高为100%

Information how to use visible and collapsed https://www.tjvantoll.com/2015/06/05/nativescript-showing-and-hiding-elements/信息如何使用可见和折叠https://www.tjvantoll.com/2015/06/05/nativescript-showing-and-hiding-elements/

BTW there is a problem with android on setting isUserInteractionEnabled https://github.com/NativeScript/NativeScript/issues/3215顺便说一句,android 在设置 isUserInteractionEnabled 时存在问题https://github.com/NativeScript/NativeScript/issues/3215

If you need this to show an activity indicator as an overlay with a dimmed background, you could use this one: https://github.com/nstudio/nativescript-loading-indicator如果您需要将活动指示器显示为背景变暗的叠加层,您可以使用这个: https : //github.com/nstudio/nativescript-loading-indicator

import {LoadingIndicator} from '@nstudio/nativescript-loading-indicator'
const loader = new LoadingIndicator()
loader.show({dimBackground: true})
loader.hide()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM