0

私はゲームを作成しており、.9.png のスプラッシュ画像は画面を垂直に埋める必要があります (向きはポートレイトです) が、画面の上部と下部に小さな境界スペースを残しますが、境界に関しては逆になります間隔、それはスプラッシュ画像の両側に間隔を残します。

これが私のsplashscreen.xmlです

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView  android:id="@+id/splashScreenImage"
    android:src="@drawable/starfighter"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
</ImageView>
<TextView 
android:text="game by: alphy poxy - graphics by: alpho07"
android:id="@+id/creditsText"
android:layout_gravity="center_horizontal|bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</FrameLayout> 

私のマニフェストファイルの一部

  <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.space_fighter.MainActivity"
        android:label="@string/app_name" android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="SFMainMenu" android:screenOrientation="portrait">      </activity>
</application>
4

1 に答える 1

1

それはすべて、指定した画像に依存します。

scaleType="centerInside"forを指定するとImageView、画像は xy 比を維持しながら割り当てられたスペースに収まります。したがって、目的の画像比率の画像をポイントすると、目的の効果が得られます。

使用例はこちらのサイトを参考にしてくださいscaleType

于 2012-12-30T10:04:45.357 に答える