This problem occurs mainly after 4.4, allowing the use of the immersive title bar after 4.4 or 4.4 without using the immersive title bar is no problem, so if your app uses an immersive title bar, and you need to enter content, you can use this method
1. Add a layer of scrollview to the outside of the main part of the XML, which is where the red circle in the graph
2. Add this code to the activity's OnCreate
If (build.version. Sdk_int >= { final View Decorview = GetWindow (). Getdecorview (); Decorview.getviewtreeobserver (). Addongloballayoutlistener ( New Viewtreeobserver.ongloballayoutlistener () {@Override public void ongloballayout () { Rect rect = new rect (); Decorview.getwindowvisibledisplayframe (rect); int screenheight = Decorview.getrootview (). GetHeight (); int height = screenheight-rect. bottom ; Layoutparams layoutparams = ScrollView . Getlayoutparams ();//( What type of layoutparams is dependent on what type of ScrollView parent is layoutparams.setmargins (0,0,0,height); ScrollView . Requestlayout (); } });}
Usually this is OK, but there is a small problem, like I have a button in the page below, the button is not in ScrollView, this situation will cause the actual display of the input method at the top and the current input edit box between the interval, the distance is the distance of the button, which The distance should be to put this button, but I do not know how to let this button up in the input, like before 4.4
This is the top of the XML layout include the title, TextView is the Submit button, the following is the middle of the body ScrollView
I put this more stupid method to write, because I was in the solution of this problem Baidu Google for a long time there is no real good plan, I this program although not very good, but at least to solve the problem, I hope to help you, if there is a better solution, please enlighten me
qq:1075770442
Android edit box is masked by input method, effective processing method