如何使Android
EditText在初始化时不得到焦点:
1.使用:
myEditText.clearFocus();
myEditText.setSelected(false);
都不好用
2.通过实践没有问题,在EditText上面加一个隐藏的linearLayout,如下:
其实完全没有必要隐藏的ViewGroup,就写在根节点的ViewGroup就可以了
<LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px" /> <EditText 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" />