Android-如何在不同的屏幕上自动调整图像大小
我在屏幕上得到固定的图像大小,因为它在标签中显示正常,但在较小的屏幕上,它保持原来的大小 我尝试过不同的方法,但没有成功 我正在发布XML,请看一看,谢谢Android-如何在不同的屏幕上自动调整图像大小,android,eclipse,imageview,Android,Eclipse,Imageview,我在屏幕上得到固定的图像大小,因为它在标签中显示正常,但在较小的屏幕上,它保持原来的大小 我尝试过不同的方法,但没有成功 我正在发布XML,请看一看,谢谢 <LinearLayout android:id="@+id/mainLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" an
<LinearLayout
android:id="@+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="@+id/Item1"
android:layout_alignParentTop="true"
android:layout_marginTop="100dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/img_A1" />
</LinearLayout>
谢谢你的帮助 android不会自行调整图像大小。取而代之的是,它从不同屏幕尺寸的手机的可绘制资源中获取不同的图像
ldpi- is for the lower resolutions image phones
mdpi- for medium level density pixels phones
hdpi- for higher density pixels phones
xdpi-for high resolution phones.
xxdpi- for more high resolution phones.
您必须在这些文件夹中存储同名但大小不同的图像,以便android可以根据屏幕大小和分辨率选择相关图像。android不会自行调整图像大小。取而代之的是,它从不同屏幕尺寸的手机的可绘制资源中获取不同的图像
ldpi- is for the lower resolutions image phones
mdpi- for medium level density pixels phones
hdpi- for higher density pixels phones
xdpi-for high resolution phones.
xxdpi- for more high resolution phones.
您必须在这些文件夹中存储同名但大小不同的图像,以便android可以根据屏幕大小和分辨率选择相关图像。android不会自行调整图像大小。取而代之的是,它从不同屏幕尺寸的手机的可绘制资源中获取不同的图像
ldpi- is for the lower resolutions image phones
mdpi- for medium level density pixels phones
hdpi- for higher density pixels phones
xdpi-for high resolution phones.
xxdpi- for more high resolution phones.
您必须在这些文件夹中存储同名但大小不同的图像,以便android可以根据屏幕大小和分辨率选择相关图像。android不会自行调整图像大小。取而代之的是,它从不同屏幕尺寸的手机的可绘制资源中获取不同的图像
ldpi- is for the lower resolutions image phones
mdpi- for medium level density pixels phones
hdpi- for higher density pixels phones
xdpi-for high resolution phones.
xxdpi- for more high resolution phones.
您必须在这些文件夹中存储名称相同但大小不同的图像,以便android可以根据屏幕大小和分辨率选择相关图像。正如前面指出的,android不会调整图像大小。你必须手动操作。你可以用
scaledBmp = Bitmap.createScaledBitmap(bitmap, width, height, true);
一旦您调整了图像的大小,您可以调用
item1.setImageBitmap(scaledBmp);
正如已经指出的,Android不会调整图像的大小。你必须手动操作。你可以用
scaledBmp = Bitmap.createScaledBitmap(bitmap, width, height, true);
一旦您调整了图像的大小,您可以调用
item1.setImageBitmap(scaledBmp);
正如已经指出的,Android不会调整图像的大小。你必须手动操作。你可以用
scaledBmp = Bitmap.createScaledBitmap(bitmap, width, height, true);
一旦您调整了图像的大小,您可以调用
item1.setImageBitmap(scaledBmp);
正如已经指出的,Android不会调整图像的大小。你必须手动操作。你可以用
scaledBmp = Bitmap.createScaledBitmap(bitmap, width, height, true);
一旦您调整了图像的大小,您可以调用
item1.setImageBitmap(scaledBmp);
为线性布局提供weightsum属性,将其值设为100,并将imageview的权重设为50或60。另外,将图像高度设为0 dp。在布局上,它显示良好,但在小屏幕手机上无法按要求工作:(为线性布局提供weightsum属性,将其值设为100,并将imageview的权重设为50或60。同时将图像高度设为0 dp。在布局上,它显示良好,但在小屏幕手机上不起作用:(为线性布局提供weightsum属性,将其值设为100,并将imageview的权重设为50或60。同时将图像高度设为0 dp。在布局上,它显示良好,但在小屏幕手机上不起作用:(为线性布局提供weightsum属性,将其值设为100,并将imageview的权重设为50或60。同时将图像高度设为0 dp。在布局上,它显示良好,但在小屏幕手机上不起作用:(