EditText设置启动时默认的焦点,防止启动打开软键盘

来源:互联网 发布:树莓派3 网络配置 编辑:程序博客网 时间:2024/04/30 14:10

方法1

在Edit的父view设置如下属性:

android:focusable="true" android:focusableInTouchMode="true"
方法2

在EditText前面放置一个看不到的LinearLayout,让它率先获取焦点

<LinearLayout        android:focusable="true" android:focusableInTouchMode="true"        android:layout_width="0px" android:layout_height="0px"/>


0 0
原创粉丝点击