Reputation: 1345
I have an activity. This activity's layout has one ViewPager. This viewpager has five fragment by code. And I have five icons at the bottom of screen. They are located in tablayout.
Come to main point, When I open keyboard, the keyboard lift tablayout to top? How can solve it ?
I tried the ways below :
android:isScrollContainer="false"
android:fitsSystemWindows="true"
EDIT : I updated my layout. Any ideas for this problem so far ?
activity_home.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activityRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/appBarLayout">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
android:isScrollContainer="true"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionGroup="false"
android:layout_weight="1" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
style="@style/MyCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="@drawable/bottom_bar_background"
app:tabMode="fixed"
app:tabPaddingEnd="0dp"
app:tabPaddingStart="0dp"
app:tabTextAppearance="@style/MyCustomTabText" />
</LinearLayout>
</ScrollView>
<include
layout="@layout/navigation_drawer_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/tabs"
android:layout_gravity="start"
android:layout_marginBottom="?actionBarSize" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Upvotes: 2
Views: 944
Reputation: 3285
Alex's answer is absolutely right.
You can't set
android:windowSoftInputMode="adjustPan|adjustResize"
, this combination is illegal.
Instead just set it to pan android:windowSoftInputMode="adjustPan"
it will not move TabLayout
to top. But there is one more thing I would like to add. adjustPan and adjustResize work as expected only when you have set android:fitsSystemWindows="true"
in your root layout.
So your layout should be
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activityRoot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
// Your Layout
</RelativeLayout>
Upvotes: 0
Reputation: 6201
You can't set android:windowSoftInputMode="adjustPan|adjustResize"
this combination is illegal as stated in the docs:
Setting multiple values in either group — multiple "state..." values, for example — has undefined results
Instead just set it to pan android:windowSoftInputMode="adjustPan"
If the soft keyboard alters your layout it means that either android:windowSoftInputMode="adjustResize"
or android:windowSoftInputMode="adjustUnspecified"
were set. For the latter case the system will deciede automatically if to pan or resize, it will resize if it finds any views that can be scrolled.
Upvotes: 0