应用栏上方留空 space
Empty space above the app bar
如何去掉下面显示的空白 space(水平红线之间的 space)?在获得新的 phone(三星 S8)之前,我没有在我的应用程序上看到这个,它比我的旧 HTC One 有更多的垂直屏幕 space。
那个 activity 的布局文件的开头是:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout ...
我的values-v14/styles.xml是
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
我尝试用谷歌搜索这个问题,但我找不到任何东西 -- 我一定是在搜索错误的术语。我需要编辑什么文件才能使应用操作栏上方的空白 space 消失?
编辑:为了比较,这是应用程序在模拟器中的样子(它在我的 HTC One 上看起来一样):
当我在我的三星 S8 上 运行 时,我希望该应用程序的行为与上述相同(即操作栏上方没有黑色 space)。我需要更改什么?
改变这个<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
希望这会对您有所帮助,如果没有请 post 您的完整 xml 文件
乐于助人
这是由于 Samsung Galaxy S8 的纵横比更宽所致。默认情况下,Android 应用程序支持 16:9 的最大纵横比。要解决此问题,请将此元素添加到清单中的 <application>
标记内:
<meta-data android:name="android.max_aspect" android:value="2.1" />
此 Google 博客 post 中提供了完整的详细信息:https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html
如何去掉下面显示的空白 space(水平红线之间的 space)?在获得新的 phone(三星 S8)之前,我没有在我的应用程序上看到这个,它比我的旧 HTC One 有更多的垂直屏幕 space。
那个 activity 的布局文件的开头是:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout ...
我的values-v14/styles.xml是
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
我尝试用谷歌搜索这个问题,但我找不到任何东西 -- 我一定是在搜索错误的术语。我需要编辑什么文件才能使应用操作栏上方的空白 space 消失?
编辑:为了比较,这是应用程序在模拟器中的样子(它在我的 HTC One 上看起来一样):
当我在我的三星 S8 上 运行 时,我希望该应用程序的行为与上述相同(即操作栏上方没有黑色 space)。我需要更改什么?
改变这个<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
希望这会对您有所帮助,如果没有请 post 您的完整 xml 文件
乐于助人
这是由于 Samsung Galaxy S8 的纵横比更宽所致。默认情况下,Android 应用程序支持 16:9 的最大纵横比。要解决此问题,请将此元素添加到清单中的 <application>
标记内:
<meta-data android:name="android.max_aspect" android:value="2.1" />
此 Google 博客 post 中提供了完整的详细信息:https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html