前言
在前些日子中,DFQ默認的全屏方案在各種花裏胡哨的安卓手機屏幕(如水滴屏、額頭屏等全面屏)中出現大黑邊。
在遊戲應用中,如果兩邊有黑邊,自然是玩起來不舒服的;所以只能尋找解決方案進行適配。
經過一番搜尋、實踐,發現問題意外的簡單。
解決方案
只需要在AndroidManifest.xml中對應的Application 標籤中,添加以下內容即可:
1 2 3 |
<meta-data android:name="android.max_aspect" android:value="2.3" /> |
添加以後,絕大部分的機型都能自動適應。
AndroidManifest.xml文件大致如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.koiyun.dfq" android:installLocation="auto" android:versionCode="12" android:versionName="1.0.0"> <!-- 權限之類的內容 --> <application android:allowBackup="true" android:icon="@drawable/icon" android:label="DF·Quest" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <!-- 在此處添加 --> <meta-data android:name="android.max_aspect" android:value="2.3" /> <!-- Activity 標籤的內容 --> </application> <uses-feature android:glEsVersion="0x00020000" /> </manifest> |