应用栏上方的空白区域 [英] Empty space above the app bar
问题描述
如何摆脱下面显示的空白空间(水平红线之间的空间)?直到买到一部新手机(三星S8),它的垂直屏幕空间都比我以前的HTC One多,我才在我的应用程序上看到它.
How do I get rid of the empty space shown below (the space between the horizontal red lines)? I didn't see this on my app until getting a new phone (Samsung S8), which has more vertical screen space than my old HTC One.
该活动的布局文件的开头是:
The beginning of the layout file for that activity is:
<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 ...
我的值-v14/styles.xml是
My values-v14/styles.xml is
<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>
我尝试使用Google搜索该问题,但找不到任何内容-我必须搜索错误的术语.我需要编辑什么文件才能消除应用程序操作栏上方的空白?
I tried googling this problem but I couldn't find anything -- I must be searching for the wrong terms. What file do I need to edit to make the empty space above my app's action bar go away?
为了进行比较,这是该应用在模拟器中的外观(在我的HTC One上是相同的方式):
for comparison, here's what the app looks like in the emulator (it looks the same way on my HTC One):
当我在Samsung S8上运行该应用程序时,我希望该应用程序具有与上述相同的行为(即操作栏上方没有黑色空间).我需要更改什么?
I'd like the app to behave the same way as above (i.e. no black space above the action bar) when I run it on my Samsung S8. What do I need to change?
推荐答案
这是由于Samsung Galaxy S8的宽高比较大而发生的.默认情况下,Android应用程序支持最大纵横比为16:9.要解决此问题,请将此元素添加到清单中的<application>
标记内:
This is happening due to the wider aspect ratio of the Samsung Galaxy S8. By default, Android applications support a maximum aspect ratio of 16:9. To solve, add this element inside the <application>
tag in your manifest:
<meta-data android:name="android.max_aspect" android:value="2.1" />
此Google博客文章中的完整详细信息: https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html
Full details available in this Google blog post: https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html
这篇关于应用栏上方的空白区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!