方法有5个
<1>在Xml文件中在其父控件下,添加如下的属性,就可以完美解决:
android:focusable = "true"
android:focusablenTouchMode="true"
<2>直接在editext控件中添加一句<requestFocus />
<EditText
android:id="@+id/et_feedback"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="@drawable/advice_button_selector"
android:gravity="top"
android:hint="填写意见"
android:maxLines="10"
android:minLines="10"
android:textColor="#8F8F8F"
android:textColorHint="#8F8F8F"
android:textSize="15sp" >
<requestFocus />
</EditText>
<3>直接关闭输入法
private
void
closeInputMethod() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
boolean
isOpen = imm.isActive();
if
(isOpen) {
// imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);//没有显示则显示
imm.hideSoftInputFromWindow(mobile_topup_num.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}