Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 操作栏覆盖未按预期工作_Android_Android Actionbar - Fatal编程技术网

Android 操作栏覆盖未按预期工作

Android 操作栏覆盖未按预期工作,android,android-actionbar,Android,Android Actionbar,我的Android应用程序有一个半透明的操作栏。当我触摸屏幕时,它会隐藏,当再次触摸屏幕时,它会再次显示 /value-11/styles.xml @样式/全屏ActionBarStyle 真的 @空的 ?安卓:属性/按钮样式 ?android:attr/buttonBarButtonStyle @彩色/黑色覆盖 当我启动应用程序时,ActionBar是半透明的,这是预期的状态。当我使用getActionBar().hide()隐藏它时并使用getActionBar().show()使其再次

我的Android应用程序有一个半透明的
操作栏
。当我触摸屏幕时,它会隐藏,当再次触摸屏幕时,它会再次显示

/value-11/styles.xml

@样式/全屏ActionBarStyle
真的
@空的
?安卓:属性/按钮样式
?android:attr/buttonBarButtonStyle
@彩色/黑色覆盖
当我启动应用程序时,
ActionBar
是半透明的,这是预期的状态。当我使用
getActionBar().hide()隐藏它时并使用
getActionBar().show()使其再次显示它不再是半透明的

它是ViewPager中的
片段。如果我只是向右滚动,hide和show的工作原理与预期的一样:在
show()之后,
ActionBar
是半透明的被调用

更新:每次我向左滚动,错误又出现了

有没有人知道如何解决这个问题,因此它也可以在第一页上使用,或者当用户向左滚动一个或多个页面时使用?

我解决了我的问题:

ViewPager内的视图布局如下所示:

<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/presentation"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:contentDescription="@string/presentation"
    android:scaleType="fitCenter"
    android:fitsSystemWindows="true" >
</ImageView>

android:fitsystemwindows=“true”
是这个奇怪的bug的罪魁祸首,没有这个,一切正常


很抱歉编写了这么少的代码,我只是认为这是一个Java代码问题,与xml无关。我找不到一个代码块,大概就是那个有错误的代码块。我该怎么做,错误在我的布局文件中。;)

嗨,你能给出一些可执行的示例代码吗。识别你的问题很容易。。
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/presentation"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:contentDescription="@string/presentation"
    android:scaleType="fitCenter"
    android:fitsSystemWindows="true" >
</ImageView>