0
,例如,如果一个80dp正方形布局包含一个较小的ImageView,ImageView的大小不会被缩放:如何在大于父级时将ImageView的大小独立于父级?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="#FFFF00"
android:clipChildren="true">
<ImageView
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/sym_def_app_icon" />
</RelativeLayout>
但如果父比ImageView的较小的,例如:30DP:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="#FFFF00"
android:clipChildren="true">
<ImageView
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/sym_def_app_icon" />
</RelativeLayout>
它会被自动缩放:
,但我想要的ImageView的裁剪而不是缩放:
我怎样才能在XML这种作物的影响?