本文介绍了调整上onDoubleTapEvent的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要调整的的ImageView
在 doubleTapEvent
。一个code例子将是真正有用的。
I want to resize an ImageView
on doubleTapEvent
. A code example will be really helpful.
推荐答案
XML:
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myImage"
android:src="@drawable/myPicture"
android:layout_width="64sp"
android:layout_height="64sp"
/>
Java的:
public class MyActivity extends Activity implements OnDoubleTapListener{
private ImageView img;
private static int NEW_WIDTH = 100;
private static int NEW_HEIGHT = 100;
@Override
public void onCreate(Bundle savedInstanceState){
setContentView(R.layout.myLayout);
this.img = findViewById(R.id.myImage);
img.setOnDoubleTapListener(this);
}
public boolean onDoubleTap(MotionEvent e){
this.img.setLayoutParams(new LayoutParams(NEW_WIDTH, NEW_HEIGHT));
}
这样的事情...
Something like this...
这篇关于调整上onDoubleTapEvent的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!