0
我想构建一个android应用程序,问题是我想要四个ImageButtons来覆盖所有的屏幕宽度。所以我的问题是不同的屏幕大小我的图像应该是什么尺寸? 例如,在具有4英寸屏幕的设备中,每个图像的大小应该是多少?支持多屏幕的Android应用程序?
我想构建一个android应用程序,问题是我想要四个ImageButtons来覆盖所有的屏幕宽度。所以我的问题是不同的屏幕大小我的图像应该是什么尺寸? 例如,在具有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以及水平方向并为每个imageView设置权重。 –