Xamarin.Android - 表单透明

问题描述 投票:0回答:1
c# xamarin xamarin.android transparent
1个回答
0
投票

您可以向文件 styles.xml 添加样式,如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
      <style name="AppTheme1" parent="android:Theme.Material.Light">

                        <item name="android:windowIsTranslucent">true</item>

                        <item name="android:windowBackground">@android:color/transparent</item>

                        <item name="android:windowContentOverlay">@null</item>

                        <item name="android:windowNoTitle">true</item>

                        <item name="android:windowIsFloating">true</item>

                        <item name="android:backgroundDimEnabled">false</item>

                        <!-- Customize your theme here. -->

                        <item name="android:windowIsFloating">true</item>

                  
      </style>
</resources>

并将该样式应用到您的活动中:

 [Activity(Label = "@string/app_name", Exported = true,Theme = "@style/AppTheme1" )]
© www.soinside.com 2019 - 2024. All rights reserved.