(tablayout) Tabs come over the keyboard when editText is focused
Asked Answered
H

2

7

I have setUp tabLayout with ViewPager which has 5 Fragments. tabLayout with android:layout_gravity set to bottom . Third fragment has editText which when focused , my tabs come over the keyboard.

Tablayout without EditText

TabLayout with EditText

Main layout :

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/coordinatorLayout"
        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
              android:id="@+id/t"
             layout="@layout/toolbar"/>


        </android.support.design.widget.AppBarLayout>

  <android.support.v4.view.ViewPager
    android:id="@+id/viewPager"
    android:layout_width="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"/>

  <android.support.design.widget.TabLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tab="http://schemas.android.com/tools"
    android:layout_gravity="bottom"
    app:tabGravity="fill"
    android:background="@color/colorPrimary"
    android:layout_alignParentBottom="true"
    android:id="@+id/tabs"

    app:layout_collapseMode="parallax"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"

    xmlns:android="http://schemas.android.com/apk/res/android">


    </android.support.design.widget.TabLayout></android.support.design.widget.CoordinatorLayout> 

Third Fragment layout :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:hint="Enter something"
        />
</LinearLayout> 
Hadwin answered 23/7, 2016 at 19:1 Comment(0)
O
11

Open AndroidManifest.xml and add to your activity tag android:windowSoftInputMode="adjustPan"

If this doesn't work add android:windowSoftInputMode="adjustNothing"

This will prevent the soft keyboard from adjusting the layout.

Hope this helps.

Orellana answered 23/7, 2016 at 19:12 Comment(0)
P
0

Put The TabLayout under the ToolBar and aove the ViewPager

Parker answered 23/7, 2016 at 19:6 Comment(1)
Look here: #33381168Parker

© 2022 - 2024 — McMap. All rights reserved.