如何在Xamarin android中使活动透明

时间:2014-09-24 09:00:14

标签: xamarin

我已提到here。但我只看到一个黑色的背景。 然后我使用Android标准主题" ThemeTranslucentNoTitleBar"。它仍然是黑色背景。那么如何让活动完全透明呢?

protected override void OnCreate(Bundle bundle)
    {
        SetTheme(Android.Resource.Style.ThemeTranslucentNoTitleBar);
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.xxx);
    }

1 个答案:

答案 0 :(得分:2)

经过多次尝试。我找到了解决方案。您还必须设置Android应用程序主题。例如<application android:theme="@android:style/Theme.Translucent" />如果您使用的是自定义应用程序主题。别忘了设置android:windowIsTranslucent = true
<style name="CustomTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/CustomActionBar</item> <item name="android:actionMenuTextColor">@color/actionbar_text</item> <item name="android:windowIsTranslucent">true</item> </style>