请问各位,编写的EditText控件时,如何自己控制键盘的显示与隐藏

解决方案 »

  1.   

    <LinearLayout
            android:focusableInTouchMode="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
         <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"/>
    </LinearLayout>
      

  2.   

    首先,找到包含有EditText的那个Activity;
    其次,在该Activity被注册的那个AndroidMinifest.xml文件中找到对应的那个Activity标签;
    最后,在该Activity标签中加入这个属性值:
    android:windowSoftInputMode="stateHidden|adjustResize"
    这样,就可以让界面一开始软键盘就会被隐藏的效果,只有点击输入栏时才会被显示