1

다음 코드를 코디네이터 레이아웃에서 사용했으며 사용자 정의 축소 도구 모음 디자인을 사용하고 있습니다. 내가 낮은 OS 버전에이 응용 프로그램을 실행할 때 모든 viewpager 조각 Recyclerviews에 스크롤하는 동안Recyclerview 중첩 된 스크롤보기 내부에있는 ViewPager

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:ignore="RtlHardcoded"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/main.appbar" 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:background="@drawable/backg"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/main.collapsing" 
      android:layout_width="match_parent" 
      android:layout_height="250dp" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> 

      <FrameLayout 
       android:id="@+id/main.framelayout.title" 
       android:layout_width="match_parent" 
       android:layout_height="130dp" 
       android:layout_gravity="bottom" 
       android:background="#00000000" 
       android:orientation="vertical" 
       app:layout_collapseMode="parallax" 
       app:layout_collapseParallaxMultiplier="0.3"> 

       <LinearLayout 
        android:id="@+id/main.linearlayout.title" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:paddingLeft="30dp" 
        android:layout_gravity="left" 
        android:orientation="vertical"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:gravity="bottom" 
         android:text="User Name" 
         android:id="@+id/username" 
         android:textColor="@android:color/white" 
         android:textSize="30sp"/> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="4dp" 
         android:id="@+id/business" 
         android:text="Users Business" 
         android:textColor="@android:color/white"/> 
       </LinearLayout> 

      </FrameLayout> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/main.toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="110dp" 
       android:background="#00000000" 
       app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
       app:title="" 
       app:layout_collapseMode="pin"> 

       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:orientation="horizontal"> 

        <ImageView 
         android:layout_width="32dp" 
         android:layout_height="32dp" 
         android:id="@+id/back" 
         android:layout_marginTop="10dp" 
         android:background="@drawable/ic_arrow_back"/> 

        <TextView 
         android:id="@+id/main.textview.title" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:padding="12dp" 
         android:text="User Name" 
         android:textColor="@android:color/white" 
         android:textSize="24sp" 
         /> 

       </LinearLayout> 
      </android.support.v7.widget.Toolbar> 
      <android.support.design.widget.TabLayout 
       android:id="@+id/tabs" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="#00000000" 
       android:layout_gravity="bottom" 
       app:tabMode="fixed" 
       app:tabGravity="fill" 
       app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

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

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

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_gravity="fill_vertical" 
     android:fillViewport="true" 
     android:layout_marginBottom="110dp"> 

      <android.support.v4.view.ViewPager 
       android:id="@+id/viewpager" 
       android:layout_width="match_parent" 
       android:layout_gravity="fill_vertical" 
       android:layout_height="match_parent" 
       android:background="@android:color/white"> 
      </android.support.v4.view.ViewPager> 
    </android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 

지금 내가이 직면하고있는 무슨 문제, 모든 괜찮지 만 난 Android.M 위의 OS를 사용하는 경우, recyclerview의 높이입니다 화면에 표시되지 않으며 항목이 화면에 표시 될 정도로 보이지 않습니다. 제 문제를 해결하도록 도와주세요. 내 맞춤식 축소 형 막대 레이아웃을 설계했지만 아래 Android OS에서는 모두 괜찮습니다. 난 내 액션 바 크기의 margin_bottom를 추가 할 때

[EDITED 여기
몇 가지 스냅 샷입니다.
enter image description here < --- 스냅 샷 끝.
marginBottom을 사용할 때 viewpagers 높이가 화면 크기보다 작다는 것을 볼 수 있습니다.
지금
more higher varients의 경우 marginBottom을 사용하는 동안 모두 아래 사항을 준수해야합니다.
enter image description here

답변

1

당신의 리뷰와 내 질문에 대한 답변을 주셔서 감사합니다, 그러나 많은 내가 발견 didnt한다 아무것도 유용 파고, 그리고 프로그래밍 높이를 설정하는 생각 후. 그래서 나는 아래의 스 니펫을 시도했고 그것은 매력처럼 작동합니다. 하이 저 변수의 경우 well, NestedScrollView의 layout xml에 액션 바 크기와 marginBottom을 설정하고 하위 변수의 경우 아래에서이 해킹을 사용하십시오.

NestedScrollingView nsv = findViewByID(R.id.nsv); 

if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M){ 
     android.support.design.widget.CoordinatorLayout.LayoutParams lpm = new android.support.design.widget.CoordinatorLayout.LayoutParams(
       android.support.design.widget.CoordinatorLayout.LayoutParams.MATCH_PARENT, android.support.design.widget.CoordinatorLayout.LayoutParams.MATCH_PARENT); 
     lpm.setMargins(0,0,0,0); 
     lpm.setBehavior(new android.support.design.widget.AppBarLayout.ScrollingViewBehavior()); 
     nsv.setLayoutParams(lpm); 
     nsv.requestLayout(); 
    } 

다시 귀하의 도움에 감사드립니다.

0

viewpapger 상단에 linearLayout을 추가하고 시도해 볼 수 있습니다.

<android.support.v4.widget.NestedScrollView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:minHeight="800dp" 
    android:orientation="vertical"> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"/> 
+0

나는 scrollview를 이미 사용하고 있으며, 축소 도구 모음을 사용하고 있으므로 nestedscrollviewenabled = "true"와 함께 사용했지만 더 이상 작동하지 않습니다. 내가 직면하고있는 문제는 NestedScrollView 내부에서 유지되는 viewpage의 높이입니다. – ShockWave

+0

새 코드를 추가했습니다. 그 중 하나를 선택하고 knw하자 – Anonymous

+0

당신이 내게 말한 제안을 시도했지만, 내가 직면하고있는 문제는 viewPagers 높이입니다. fillViewPort = "true"를 중첩 된 스크롤 레이아웃에 추가하면 전체 높이를 차지하게되고, 이로 인해 recyclerview는 viewpager의 전체 높이를 차지하게되고 나머지 다른 항목은 화면을 출력하지만 heah, hack 내 도구 모음 높이의 marginBottom을 추가 할 때 제대로 작동하지만 지금은 문제가 더 낮은 버전과 같습니다 – ShockWave

0

귀하의 문제를 올바르게 이해하는 경우 툴바의 여백을 추가해야합니다 (이미 말씀 드린 것처럼). 나는 다음과 같이 layout_gravity을 추가하여이 문제를 해결했다.

<android.support.v4.widget.NestedScrollView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
android:layout_gravity="fill_vertical" 
android:layout_marginBottom="?attr/actionBarSize"> 
+0

그렇습니다. actionbar 크기의 여백 Bottom을 추가 할 때마다, 고등어 변수에 대한 문제를 해결하고 있습니다. 그러나이 여백은 낮은 OS 변형에 대해서는 문제가 있으며 하위 OS에서는 뷰 페이지 아래에 공백을 표시합니다. – ShockWave

+0

'android : layout_gravity'도 추가 했습니까? –

+0

FrameLayout에서'android : fitsSystemWindows = "true"'를 사용하는 것이 문제가 될 수 있습니다. 나는 코디네이터 배치에서 그것을 사용하는 데 많은 어려움을 겪었다. –