android - I don't get ACTION_DOWN on ScrollView -
android - I don't get ACTION_DOWN on ScrollView -
i scroll view, , within linear layout imageview.
<scrollview android:layout_weight="41" android:layout_width="0dip" android:layout_height="match_parent" android:background="@color/light_red_zone" android:id="@+id/scrl_pass" android:clickable="true" android:layout_gravity="center"> <linearlayout android:id="@+id/lytpass" android:background="@color/light_red_zone" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="left" /> </scrollview>
i add together imageview dynamically within linearlayout, , has listener
img1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { savelog(new dat_log_da(id_tile, long.tostring(system.currenttimemillis()), id_configurazione)); if (semaphoreaudio.tryacquire()) { play(m1); } } });
that start media player when touch images.
then, need motion event on scroll view, add together touch listener scroll view
scrl_pass = (scrollview) findviewbyid(r.id.scrl_pass);scrl_pass.setontouchlistener(new view.ontouchlistener() { private float = 0; private static final string tag = "scroll view"; @override public boolean ontouch(view v, motionevent motionevent) { log.d(tag, "action " + motionevent.getactionmasked()); if ((motionevent.getactionmasked() == motionevent.action_down) || (motionevent.getactionmasked() == motionevent.action_pointer_down)) { = motionevent.gety(); log.d(tag, "action downwards " + my); } else if ((motionevent.getactionmasked() == motionevent.action_up) || (motionevent.getactionmasked() == motionevent.action_pointer_up)) { log.d(tag, "action da " + + " " + motionevent.gety()); float currentposition = scrl_pass.getscrollx(); } homecoming false; } });
the problem action_move (id=2) , action_up (id=1), don't action_down if it's performed on 1 of imageviews
android ontouchlistener motionevent
Comments
Post a Comment