Android add OnTouchListener to EditText in LinearLayout -
i have layout constructed in xml multiple edittext fields among other stuff. here's part of layout:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:splitmotionevents="false" android:scrollbars="vertical" > <linearlayout android:layout_width="fill_parent" android:id="@+id/linearlayout01" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginbottom="5dp" android:background="#808080" android:gravity="center_vertical|center_horizontal" android:orientation="horizontal" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="12dp" android:layout_weight="1" android:gravity="left" android:text="property detail " android:textcolor="#000000" > </textview> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_weight="1" android:text="step(1 of 3)" android:textcolor="#ffffff" > </textview> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="35dp" android:layout_marginbottom="5dp" android:gravity="center_vertical|center_horizontal" android:orientation="horizontal" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="12dp" android:layout_weight="1" android:gravity="left" android:text="select date" android:textsize="18dp" /> <textview android:id="@+id/activity_newproperty_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/activity_new_property_date" android:textsize="18dp" /> <imageview android:id="@+id/activity_newproperty_pickdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="15dp" android:src="@drawable/calender_ico" /> </linearlayout> . . .
i trying implement swipe listener on whole of screen. meaning, whenever user swipes anywhere on screen (right or left) screen go next or previous screen respectively!
i have written code swipe detection extending ontouchlistener. problem arises when try add listener screen. tried following stuff:
- add ontouchlistener outermost linearlayout only. way, when swiped on edittext, doesn't detect. rather, edittext focused
- add listener childs writing recursive function. gets swipe working good. but edittext no longer focusable when clicked! tried
android:focusableintouchmode = "true"
of no use! maybe should cast them edittext first? - one option found out
onintercepttouchevent (motionevent ev)
involves creating custom layout. whereas layout inflated xml.
what else can solve problem?
Comments
Post a Comment