Under you will the screenshots illustrating the starting layout, my current result which I am NOT happy with, and the result I want to have:
This is the opening layout which is perfect:
Then comes the current layout I get when displaying the keyboard which I am NOT happy with:
Then the result that I WANT:
Is the a line of code that will make the bottom layout ignore the android:windowSoftInputMode="stateVisible|adjustResize"
? Or how can I do this?
UPDATE:
This is what I get with adjustPan
:
because you are using
adjustResize
,
So the window is getting resize to make space for keyboard you should use
android:windowSoftInputMode="adjustPan"
with this window will not resize and current focus will never obscured by the keyboard and users can always see what they are typing.
set android:layout_alignParentBottom="true" in your Layout for example ScrollView in my layout
add in manifest
android:windowSoftInputMode="adjustResize"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:gravity="top"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="1">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_search"
android:padding="10dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btn_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:padding="15dp"
android:text="@string/test_search"
android:textAllCaps="false"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.