In the development of Android encountered problems in the solution, online search methods have some problems, so the following methods are used
Method/Step
Add ID to activity layout file
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:scrollbars= "Vertical"
Android:id= "@+id/activity_main"
>
Listen to events in the same way as normal controls.
Activity_main= (LinearLayout) Findviewbyid (R.id.activity_main);
Activity_main.setontouchlistener (New Ontouchlistener ()
{
public boolean OnTouch (View arg0, motionevent arg1)
{
Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Input_method_service);
Return Imm.hidesoftinputfromwindow (Getcurrentfocus (). Getwindowtoken (), 0);
}
});
Android Click on the screen blank to hide the soft keyboard