我想要调整图像的大小以适应屏幕,以填充整个宽度。高度应该设置为高宽比。 例如,图像尺寸是widthxheight 10x5,手机宽度是400。图像应该以200x400显示。Android布局,缩放到屏幕分辨率的宽度
我有一些设置发挥各地 机器人:scaleType =“中心”应根据文档正确的设置,但似乎没有任何效果, 机器人:scaleType =“centerCrop”适合HIGHT,使宽度大于大屏幕。
我的继承人布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageViewFrage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:padding="1dp"
android:scaleType="centerCrop"
android:src="@drawable/bg_striped_img" />
</LinearLayout>
</LinearLayout>
非常感谢
没有工作,居中图像,但使用图像的宽度和高度。也试过android:layout_width =“match_parent” android:layout_height =“match_parent” – user1324936 2012-07-09 17:35:33