我有一个用xml构建的布局,其中包含多个EditText字段。 这是布局的一部分:
<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>
.
.
.
我正在尝试在整个屏幕上实现Swipe Listener。这意味着,每当用户在屏幕上的任何位置(右侧或左侧)滑动时,屏幕将分别转到下一个或上一个屏幕!
我已经通过扩展ontouchlistener成功编写了用于滑动检测的代码。当我尝试将侦听器添加到此屏幕时,现在出现问题。我尝试了以下内容:
android:focusableInTouchMode = "true"
但没有用!也许我应该首先将它们转换为editText?onInterceptTouchEvent (MotionEvent ev)
,但这涉及到创建自定义布局。而我的布局是从xml中膨胀的。 我还能做些什么来解决这个问题?