2015-12-24 5 views
1

У меня есть основной макет:Автоматическая прокрутка NestedScrollView внутри CoordinatorLayout не работает

<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
android:focusableInTouchMode="true"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="250dp" 
    android:fitsSystemWindows="true" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:adjustViewBounds="true" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/background"/> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize"/> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:layout_gravity="bottom" 
      style="@style/RegisterVendorTabLayout"/> 
    </android.support.design.widget.CollapsingToolbarLayout> 
</android.support.design.widget.AppBarLayout> 

<android.support.v4.view.ViewPager 
    android:id="@+id/viewpager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

ViewPager имеет несколько фрагментов. Каждый фрагмент имеет компоновку, как это:

<android.support.v4.widget.NestedScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@android:color/white" 
    android:orientation="vertical"> 
       <EditText 
        android:id="@+id/et_name" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:imeOptions="actionNext"/> 
        ..... 
    </LinearLayout> 

Проблема: если пользователь нажмет на кнопку Next и некоторые поля находятся в нижней части экрана, клавиатуры будет скрывать эти поля и автоматически прокрутки Безразлично» т работы.

В AndroidManifest.xml является android:windowSoftInputMode="adjustResize" за деятельность, которая содержит этот код.

Версия библиотеки дизайна поддержки 23.1.1.

+0

Привет, используйте эту строку, ваш NestedscrollView xml app: layout_behavior = "@ string/appbar_scrolling_view_behavior" –

+0

Это не работает. – Vladimir

ответ

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