天津网站建设哪家好,吉利的广告公司名字,数据库怎么做网站,精准营销英文在项目中#xff0c;一进入一个页面, EditText默认就会自动获取焦点。 那么如何取消这个默认行为呢#xff1f; 在网上找了好久#xff0c;有点 监听软键盘事件#xff0c;有点 调用 clearFouse()方法#xff0c;但是测试了都没有#xff01; xml中也找不到相应的属性可以… 在项目中一进入一个页面, EditText默认就会自动获取焦点。 那么如何取消这个默认行为呢 在网上找了好久有点 监听软键盘事件有点 调用 clearFouse()方法但是测试了都没有 xml中也找不到相应的属性可以关闭这个默认行为 解决之道在EditText的父级控件中找一个设置成 Android:focusabletrue android:focusableInTouchModetrue 这样就把EditText默认的行为截断了 LinearLayout stylestyle/FillWrapWidgetStyle android:orientationvertical android:backgroundcolor/black android:gravitycenter_horizontal android:focusabletrue android:focusableInTouchModetrue ImageView android:idid/logo stylestyle/WrapContentWidgetStyle android:backgrounddrawable/dream_dictionary_logo / RelativeLayout stylestyle/FillWrapWidgetStyle android:backgrounddrawable/searchbar_bg android:gravitycenter_vertical EditText android:idid/searchEditText stylestyle/WrapContentWidgetStyle android:backgroundnull android:hintSearch android:layout_marginLeft40dp android:singleLinetrue / /RelativeLayout /LinearLayout 来自http://blog.csdn.NET/woshicaixianfeng/article/details/7261718 灰常感谢这位同学。。。 还有一个方法也可以非常简单的实现这个功能 EditText对象的clearFocus(); InputMethodManager imm (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editMsgView.getWindowToken(), 0);关闭软键盘。。。