1

У меня есть фрагмент с вкладками и ViewPager. В фрагменте ViewPager у меня есть EditText, и когда я пытаюсь ввести текст, ActionBar расширяется, и я не вижу EditText.ActionBar развернуть при вводе текста в EditText

Result when try to enter text in EditText

Это макет для фрагмента с вкладками и ViewPager:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<com.rey.material.widget.TabPageIndicator 
    style="@style/TabPageIndicator" 
    android:id="@+id/tabs" 
    android:layout_height="@dimen/tabs_height" 
    android:layout_width="match_parent" 
    android:clipToPadding="false" /> 
<View 
    android:id="@+id/shadow" 
    android:layout_width="match_parent" 
    android:layout_height="8dp" 
    android:background="@drawable/shadow" 
    android:layout_below="@+id/tabs"/> 

<android.support.v4.view.ViewPager 
    android:id="@+id/pager" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/shadow"/> 

Это код ToolBar:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
style="@style/ToolBarStyle" android:layout_width="match_parent" 
android:layout_height="wrap_content" android:background="?attr/colorPrimary" 
android:minHeight="@dimen/abc_action_bar_default_height_material" 
android:fitsSystemWindows="true"/> 

И это ToolBarStyle:

<style name="ToolBarStyle" parent=""> 
    <item name="android:elevation">@dimen/toolbar_elevation</item> 
    <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item> 
    <item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> 
</style> 

Что это может быть проблемой?

Заранее спасибо.

+0

, пожалуйста, напишите полный код? –

+0

вы можете добавить xml содержит код tollbar? – mustafasevgi

+0

Я добавил код для панели инструментов и стиль для панели инструментов в вопросе. Спасибо – Pamela

ответ

2

Попробуйте установить setFitsSystemWindows на панели инструментов для false

Toolbar toolbar = (Toolbar) findViewById(R.id.yourToolbar) 
toolbar.setFitsSystemWindows(false); 

Или вы можете установить его в XML, используя fitsSystemWindows в android.support.v7.widget.Toolbar

android:fitsSystemWindows="false" 
0

Чтобы включить adjustResize, добавить android:fitsSystemWindows="true" в вашей деятельности материнской макете.

Смежные вопросы