【发布时间】:2016-06-01 12:07:26
【问题描述】:
我有一个活动。此活动的布局有一个 ViewPager。这个viewpager有五个代码片段。我在屏幕底部有五个图标。它们位于 tablayout 中。
回到重点,当我打开键盘时,键盘将tablayout提升到顶部?怎么能解决呢?
我尝试了以下方法:
- android:windowSoftInputMode="adjustPan|adjustResize"
android:isScrollContainer="false"
android:fitsSystemWindows="true"
编辑: 我更新了我的布局。到目前为止对这个问题有什么想法吗?
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>
【问题讨论】:
标签: android android-layout android-fragments