android_edittext

为了避免进入activity输入法弹出问题
android:windowSoftInputMode="adjustUnspecified|stateHidden"

使用方法

<activity
    android:name=".main.fragment06_page.FaultReportActivity"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustUnspecified|stateHidden" />

输入法点击隐藏问题

((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(getCurrentFocus()
        .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

使用方法

case R.id.sousuo:
    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(getCurrentFocus()
            .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    if(sousuoTag){
        Intent intent=new Intent(this,FaultReportSearchResultActivity.class);
        intent.putExtra("content",sousuoContent.getText().toString());
        startActivity(intent);

    }else{
        Toast.makeText(this, "输入的关键词为空", Toast.LENGTH_SHORT).show();
    }
    break;

其它editText问题(点击整个editText弹出输入框)

<com.zhy.autolayout.AutoLinearLayout
    android:orientation="vertical"
    android:background="@drawable/ad_release_border"
    android:layout_width="match_parent"
    android:layout_height="300px">
    <EditText
        android:padding="10px"
        android:background="@null"
        android:id="@+id/content"
        android:textSize="15sp"
        android:maxLength="200"
        android:gravity="top"
        android:hint="请对现场进行简要说明(字数限制200)"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</com.zhy.autolayout.AutoLinearLayout>

猜你喜欢

转载自blog.csdn.net/iamchan/article/details/81213724
今日推荐