如何使 EditText 在初始化时不得到焦点:
使用:myEditText.clearFocus()
myEditText.setSelected(false);
都没好用
正确的方法是在EditText上面加一个隐藏的 linearLayout
如下:
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:id="@+id/editor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingRight="55dip"
android:background="@drawable/register"
android:editable="false"
android:maxLines="1"
android:scrollHorizontally="true"
使用:myEditText.clearFocus()
myEditText.setSelected(false);
都没好用
正确的方法是在EditText上面加一个隐藏的 linearLayout
如下:
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"
/>
android:id="@+id/editor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingRight="55dip"
android:background="@drawable/register"
android:editable="false"
android:maxLines="1"
android:scrollHorizontally="true"
android:cursorVisible="false"
/>