我的程序是两个手指一捏就将图片缩小,但是当图片被捏得太小时,让它自适应屏幕大小来显示,请问这个应该怎么做?
<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显示的宽度和高度?
解决方案 »
- 求教!BaseAdapter
- 我有一个类继承了ViewGroup(ViewGroup继承View),我如何获取getWindow呢
- 若水老师的视频代码出问题啦!!!
- 高分求教android串口通信的基本原理!!
- 用SharedPreferences存储数据报错!
- 面试题--------大神来回答啊
- ListView的内容怎么不能占满屏幕?
- Fragment不占满父控件
- 使用属性动画不停旋转图片的时候出现内存泄漏,跪求帮助该怎么解决!!!
- android 如何实现图片旋转指定度数(0-360)
- inPurgeable cannot be resolved or is not a field
- startActivityForResult运行异常
android:layout_height="fill_parent"
然后把你要显示的图片setBackGroundresouce(R.d...);
view.getLayoutParams().width