私はこのフォーラムも Android 開発も初めてです。私は最初のアプリを作成しています (JF DiMarzio による「Practical Android 4 Games Development」の本によると)、スプラッシュ スクリーンの幅が収まらないという問題は非常に一般的です。スプラッシュ画像は9patch形式です。高さは調整できますが、常に左右に少し余裕があります。どうすればそれをなくすことができますか?
本と同じようにコードを書いているので、何が悪いのかわかりません。
スプラッシュスクリーン.xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/splashScreenImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/desc"
android:src="@drawable/sfstart" >
</ImageView>
<TextView
android:id="@+id/creditsText"
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_gravity="center_horizontal|bottom"
android:text="@string/bottom" >
</TextView>
</FrameLayout>
そして MainActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//usuwa title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splashscreen);
} }
私を助けてください!
編集:関連するスレッドで解決策を見つけました- android:scaleType="fitXY" を .xml ファイルの ImageView セクションに追加しました。多分それは誰かに役立つでしょう:)