Answer the question
In order to leave comments, you need to log in
Click view is not working properly, how to fix it?
Hello
<ScrollView>
<HorizontalScrollView>
<TableLayout>
</TableLayout>
</HorizontalScrollView>
</ScrollView>
MainActivity
for (int i = 0; i < 10; i++) {
TableRow tableRow = new TableRow(this);
for (int j = 0; j < 10; j++) {
ImageView img = new ImageView(this);
....
tableRow.addView(img);
}
tableLayout.addView(tableRow);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float curX, curY;
switch (event.getAction()) {
case ACTION_DOWN:
mx = event.getX();
my = event.getY();
break;
case MotionEvent.ACTION_MOVE:
curX = event.getX();
curY = event.getY();
vScroll.scrollBy((int) (mx - curX), (int) (my - curY));
hScroll.scrollBy((int) (mx - curX), (int) (my - curY));
mx = curX;
my = curY;
break;
case MotionEvent.ACTION_UP:
curX = event.getX();
curY = event.getY();
vScroll.scrollBy((int) (mx - curX), (int) (my - curY));
hScroll.scrollBy((int) (mx - curX), (int) (my - curY));
break;
}
return true;
}
gifImageView.setOnClickListener
@Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question