Android项目中,如果在页面中,放入EditText文本输入控件,页面在加载的过程中,会让它自动接收焦点,然后弹出软件输入。这样的效果往往带来不太好的用户体验,那么如何让EditText控件不自动获取焦点呢?
没有成功的方法,我也不再说了,具体做法就是:
在EditText的父级控件中添加如下属性:
android:focusable="true"
android:focusableInTouchMode=“true”
这样就可以把问题解决啦!
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
>
<EditText
android:id="@+id/et_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="请输入内容"
/>
</LinearLayout>
Sometimes I have thought it would be an excellent rule to live as if we should die tomorrow.
要不要从今天开始认真的生活,每天过的充实一点,有意义一点,不着急改变,没有特定的要求,再等等到25岁的时候,26岁的时候,从脸上可以显示气质跟心态的时候。
所有美好的一切,慢慢的都会有。不熬夜,多读书,学习点英语,健康的饮食,调节心情,对人热情大方。用自己的心境去改变容颜。