Hello, everyone.
I have a problem about the view drag. when i drag the view, it will
blink. The code like below:
<HorizontalScrollView android:id="@+id/HorizontalScrollView01"
android:layout_below="@id/bomb_l"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_marginBottom="20dip"
android:layout_marginTop="10dip">
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow android:id="@+id/TableRow01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<AbsoluteLayout
android:id="@+id/answerSheet"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:text="@+id/TextView01" android:id="@+id/
TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"> </TextView>
</AbsoluteLayout>
</TableRow>
</TableLayout>
</HorizontalScrollView>
when i want to drag TextView01, the view will blink
@SuppressWarnings("deprecation")
@Override
public boolean onTouchEvent(MotionEvent event) {
if (isShowPress) {
int action = event.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
return super.onTouchEvent(event);
case MotionEvent.ACTION_MOVE:
curX = event.getX();
curY = event.getY();
AbsoluteLayout.LayoutParams params = new
AbsoluteLayout.LayoutParams(
135, 200, (int) curX, (int)
curY);
this.setLayoutParams(params);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
AbsoluteLayout.LayoutParams p = new
AbsoluteLayout.LayoutParams(
135, 200, 135, 0);
this.setLayoutParams(p);
break;
default:
break;
}
}
return true;
}
how can solve this problem.
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en