我有两个ImageView如下:
<ImageView android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher" />
<ImageView android:id="@+id/image2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
/>
第一个ImageView应该显示实际大小的图像,第二个ImageView应该以fitCenter的方式显示图像。
我一直在尝试这段代码:
ImageView img1 = (ImageView) findViewById(R.id.image1);
ImageView img2 = (ImageView) findViewById(R.id.image2);
img2.setImageDrawable(img1.getDrawable());
但是第二个ImageView显示的只是与第一个相同的图片。是的,它以实际尺寸显示。
有人能帮忙找到解决方案吗?
谢谢。