My idea: Use ScrollView to wrap the main content in the middle, and then remove the scroll bar of ScrollView. The effect and layout code are as follows: Note: I am currently testing that the layout below still cannot be moved up on only Android 4.4 machines. I don’t know the reason and hope to discuss it together.
Updated answer : 4.4 bug resolution, it seems that I am committing suicide in order to adapt to the status bar color of 4.4, I specially added a line in stylev19: <item name ="android:windowTranslucentStatus">true</item>
It is this line of code that causes it to be invalid on 4.4. The reason is currently unknown. As a reminder, it is best to add
in the manifest file
android:windowSoftInputMode="adjustResize"
In order for the "Next" button below to always be displayed at the bottom, I made a nest with a linearlayout of android:layout_weight=1.
Method 1: Write this code getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) before setContentView in oncreate in your activity; Method 2: Correspond to the interface in the AndroidManifest.xml file of the project Add android:windowSoftInputMode="stateVisible|adjustResize" to <activity>, which will move the entire screen upward. If you add android:windowSoftInputMode="adjustPan", the keyboard will cover the screen. Method 3: Replace the top-level layout with ScrollView, or add a layer of ScrollView encapsulation on top of the top-level Layout. This will scroll the soft keyboard and the input box together, and the soft keyboard will always be at the bottom.
My idea: Use ScrollView to wrap the main content in the middle, and then remove the scroll bar of ScrollView.
The effect and layout code are as follows:
Note: I am currently testing that the layout below still cannot be moved up on only Android 4.4 machines. I don’t know the reason and hope to discuss it together.
Updated answer : 4.4 bug resolution, it seems that I am committing suicide in order to adapt to the status bar color of 4.4, I specially added a line in stylev19: <item name ="android:windowTranslucentStatus">true</item>
It is this line of code that causes it to be invalid on 4.4. The reason is currently unknown.
in the manifest fileAs a reminder, it is best to add
In order for the "Next" button below to always be displayed at the bottom, I made a nest with a linearlayout of android:layout_weight=1.
Method 1: Write this code getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) before setContentView in oncreate in your activity;
Method 2: Correspond to the interface in the AndroidManifest.xml file of the project Add android:windowSoftInputMode="stateVisible|adjustResize" to <activity>, which will move the entire screen upward. If you add android:windowSoftInputMode="adjustPan", the keyboard will cover the screen.
Method 3: Replace the top-level layout with ScrollView, or add a layer of ScrollView encapsulation on top of the top-level Layout. This will scroll the soft keyboard and the input box together, and the soft keyboard will always be at the bottom.
Let’s see if it can be achieved using iscroll