I have a layout which I placed my widgets proportionally with weight attribute. I don't want to use scrollView, I want my widgets to fit onto screen according to their weights.
However, I want my layout to be scrollable when soft keyboard pops up. I don't want it to be resized so I can't use android:windowSoftInputMode="adjustResize"
I tried android:windowSoftInputMode="adjustPan"
and it moves the edittext field above the soft keyboard. However, this time it does not scroll and I have to close soft keyboard to choose next EditText field.I know that by adding input type, I can have forward buttons on my keyboard. However, I don't want to depend on that only, I also want it to be scrollable without resizing like in IOS.
Can I achieve that? If yes, could you explain this to me , please?
Here is my layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:orientation="vertical"
android:weightSum="20">
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" />
<FrameLayout
android:id="@+id/imagelogin"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="12"
android:gravity="center">
<ImageView
android:id="@+id/image"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/logo_home" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@color/material_blue_grey_800"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Tab 1"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Tab 2"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<include
android:id="@+id/toolbar"
layout="@layout/app_bar"></include>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8">
<LinearLayout
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:hint="Input 1" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Input 1" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Input 1" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
And this is how it looks:
That functionality isn't built into Android. If you want that, you need to put your entire layout inside of a scroll view.