Tag: focus

停止ScrollView从EditText设置焦点

Android的ScrollView(当滚动或fling'd)喜欢设置一个EditText的焦点,当它是它的一个孩子。 它发生在你滚动然后释放。 无论如何阻止这种行为? 我尝试了几乎所有我能想到的,以及我在StackOverflow上读到的所有内容。 没有任何工作对我来说。 下面是一个布局示例如果你想testing它。 我绝望地阻止这种愚蠢的行为。 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ScrollView android:id="@+id/scrollView" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginRight="50dp" android:focusable="true" android:focusableInTouchMode="true" > <EditText android:layout_width="fill_parent" android:layout_height="100dp" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" […]