Androidmanifest.xml My Android App doesn't really fill the screen

a 夏天 提交于 2019-12-11 14:53:05

问题


I am trying to make my app fill the screen for normal displays, but this is the result when I boot it up on my Samsung Captivate i897: http://oi39.tinypic.com/2qamhqd.jpg

The screen's width is filled correctly, but not the vertical side. When I set android:anyDensity to "true" in androidmanifest.xml, the app's screen is fully shown, but only on the bottom-left corner of my screen: http://oi44.tinypic.com/29w7n9v.jpg

Can someone tell me how to make the app fit to screen? Also, when an animation that takes up the whole screen is played, I get blurred and stretched images around the screen, as seen in the first screenshot link. This does not happen when I run it through moai.exe's OpenGL simulator (I am using moai-sdk and rapanui-sdk to develop my app. I imported them both into eclipse to create the apk file). I don't understand what could be the problem.

Here is how my androidmanifest.xml looks:

<?xml version="1.0" encoding="utf-8"?>
<manifest 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:installLocation="auto"
android:versionCode="1" 
android:versionName="1.0" 
package="com.gamefromscratch.moai">

<supports-screens 
        android:smallScreens="false"
        android:normalScreens="true"
        android:largeScreens="false"
        android:xlargeScreens="false"
        android:anyDensity="false"/>

<application 
    android:icon="@drawable/icon" 
    android:debuggable="true" 
    android:enabled="true" 
    android:persistent="false" 
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

    <!-- Moai -->
    <activity 
        android:name="MoaiActivity" 
        android:label="@string/app_name" 
        android:screenOrientation= "portrait"
        android:launchMode="singleTask"
        android:configChanges="keyboard|keyboardHidden|orientation">


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity 
        android:name="com.ziplinegames.moai.MoaiMoviePlayer"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:configChanges="keyboardHidden|orientation"
        android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <receiver android:name="com.ziplinegames.moai.MoaiLocalNotificationReceiver"></receiver>

    <!-- EXTERNAL DECLARATIONS: Placeholder (DO NOT MOVE OR REMOVE) -->

</application>

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

<!-- Moai -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- EXTERNAL PERMISSIONS: Placeholder (DO NOT MOVE OR REMOVE) -->



<uses-configuration android:reqTouchScreen="finger" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true" />
</manifest>   

回答1:


following attribute used for supports for multiple screen size, try this

android:smallScreens="true"
 android:normalScreens="true"
 android:largeScreens="true"
 android:xlargeScreens="true"
 android:anyDensity="true"/>

To avoid image blurring problem you have to create separate images with more pixel for drawable-hdpi,drawable-xhdpi and drawable-xxhdpi folder.

you can create separate layout folder for different size layout-large,layout-xlarge.

try this also, this will solve orientation problem android:screenOrientation="unspecified" android:configChanges="keyboardHidden|orientation"

hope this will sove your problem.



来源:https://stackoverflow.com/questions/18225467/androidmanifest-xml-my-android-app-doesnt-really-fill-the-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!