【发布时间】:2017-06-11 17:08:43
【问题描述】:
我尝试了几种解决方案,包括:
<item name="android:actionBarSize">0dp</item>
或
var activity = (Activity)Forms.Context;
this.Window.AddFlags(WindowManagerFlags.Fullscreen);
或
RequestWindowFeature(WindowFeatures.NoTitle);
或在活动字符串中
Theme = "@style/MainTheme.FullScreen"
但我找不到任何可行的解决方案,或者更确切地说,删除了歌词、电池时间等,但我仍然保持顶部栏不变,我怎样才能完全删除它?
在我添加的 iO 上:
UIApplication.SharedApplication.SetStatusBarHidden(true, true);
并且可以工作...但是 android 他让我该死 :) 解决方案?
我使用 xamarin 表单 pcl
我的样式.xaml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<!--<item name="colorPrimaryDark">#0084CA</item>-->
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#2196F3</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<!-- default -->
<item name="android:buttonStyle">@style/NoShadowButton</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#2196F3</item>
</style>
<style name="NoShadowButton" parent="android:style/Widget.Button">
<item name="android:stateListAnimator">@null</item>
</style>
</resources>
【问题讨论】:
-
您是否尝试将其添加到您的活动中?
[Activity (Label = "@string/app_name", MainLauncher = true, Theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen")] -
是但不起作用,顶栏没有隐藏
标签: c# xamarin xamarin.android xamarin.forms portable-class-library