我的程序是两个手指一捏就将图片缩小,但是当图片被捏得太小时,让它自适应屏幕大小来显示,请问这个应该怎么做?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/example"
android:background="@drawable/background"
android:scaleType="matrix" />
</RelativeLayout> float scale = newDist/oriDis;
matrix.postScale(scale, scale, midPoint.x, midPoint.y);
view.setImageMatrix(matrix);
怎样取得view显示的宽度和高度?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/example"
android:background="@drawable/background"
android:scaleType="matrix" />
</RelativeLayout> float scale = newDist/oriDis;
matrix.postScale(scale, scale, midPoint.x, midPoint.y);
view.setImageMatrix(matrix);
怎样取得view显示的宽度和高度?
android:layout_height="fill_parent"
然后把你要显示的图片setBackGroundresouce(R.d...);
view.getLayoutParams().width