2016-07-18 13 views
0

私はアンドロイドアプリケーションを構築しようとしていますが、問題は4つのImageButtonがscreenの幅をすべてカバーしたいということです。私の質問は異なるスクリーンのサイズです。 たとえば、4インチの画面を持つデバイスでは、画像のサイズはどれくらいですか?複数の画面をサポートするAndroidアプリケーションですか?

+0

.9画像はhttps://developer.android.com/studio/write/draw9patch.htmlを参照してください。 – Hardik4560

+0

あなたが本当に望んでいるものをスクリーンショットで表示し、今でもそれをやっている方法をいくつか追加しますか? –

+0

水平の向きで各画像ビューの重さを設定してLinearLayoutを使用します。 –

答えて

1

これは次のように試すことができます。これは、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> 
関連する問題