0
私はアンドロイドアプリケーションを構築しようとしていますが、問題は4つのImageButtonがscreenの幅をすべてカバーしたいということです。私の質問は異なるスクリーンのサイズです。 たとえば、4インチの画面を持つデバイスでは、画像のサイズはどれくらいですか?複数の画面をサポートするAndroidアプリケーションですか?
私はアンドロイドアプリケーションを構築しようとしていますが、問題は4つのImageButtonがscreenの幅をすべてカバーしたいということです。私の質問は異なるスクリーンのサイズです。 たとえば、4インチの画面を持つデバイスでは、画像のサイズはどれくらいですか?複数の画面をサポートするAndroidアプリケーションですか?
これは次のように試すことができます。これは、4つの画像ビューで画面の幅を均等に分割します。
<LinearLayout
android:id="@+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="4"
android:orientation="horizontal" >
<ImageView
android:id="@+id/img1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img1" />
<ImageView
android:id="@+id/img2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img2" />
<ImageView
android:id="@+id/img3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img3" />
<ImageView
android:id="@+id/img4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img4" />
</LinearLayout>
.9画像はhttps://developer.android.com/studio/write/draw9patch.htmlを参照してください。 – Hardik4560
あなたが本当に望んでいるものをスクリーンショットで表示し、今でもそれをやっている方法をいくつか追加しますか? –
水平の向きで各画像ビューの重さを設定してLinearLayoutを使用します。 –