2016-11-08 1 views
0

안녕하세요 저는 recyclerview, 예를 들어 nestedscrollview에서 recyclerview 위의 textview를 볼 수있게하고 싶습니다. recycler scroll이 평소와 같이 스크롤하는 동안 어떻게 할 수 있습니까?어떻게 recyclerview 이상의보기를 만들 nestedscrollview에서 스크롤하지

내 코드는

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:keepScreenOn="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:fillViewport="true" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center_horizontal" 
     android:focusableInTouchMode="true" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" > 

     <TextView 
      android:id="@+id/textView" 
      android:textColor="#43a047" 
      android:typeface="serif" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:text="@string/app" 
      android:gravity="center" 
      android:textStyle="bold" 
      android:textSize="15sp" /> 

     <android.support.v7.widget.RecyclerView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/recyclerview" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/textView" 
      android:layout_marginTop="5dp" 
      android:divider="@color/colorAccent" 
      android:dividerHeight="1dp" /> 

</RelativeLayout> 

</android.support.v4.widget.NestedScrollView> 

텍스트 뷰 당신은 NestedScrollView 내부 TextView

+0

을 제거? –

+0

그러면 툴바는 스크롤 응용 프로그램을 안합니다 : layout_behavior = "@ 문자열/appbar_scrolling_view_behavior", 심지어 상대적인보기에 넣음으로써 이것이 – AndroidBeginnerJhon

+0

왜 당신이 원하는 것을 보여줄 수 있습니까? –

답변

0

을 스크롤 할 수 있도록하는 방법. 따라서 부모보기로 인해 TextView이 스크롤됩니다. 그런 뭔가 작동합니다 : 당신이 여기 중첩 된 스크롤 뷰를 사용했다 않은 이유

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

    <TextView 
     android:id="@+id/textView" 
     android:textColor="#43a047" 
     android:typeface="serif" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:text="@string/app" 
     android:gravity="center" 
     android:textStyle="bold" 
     android:textSize="15sp" /> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recyclerview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView" 
     android:layout_marginTop="5dp" 
     android:divider="@color/colorAccent" 
     android:dividerHeight="1dp" /> 
</RelativeLayout> 
+0

다음 툴바 doesnot scroll app : layout_behavior = "@ string/appbar_scrolling_view_behavior", 심지어 상대 뷰에 놓음으로써. – AndroidBeginnerJhon

+0

나는 정말로 원하는 것을 이해하지 못한다. 이미지 등을 게시하십시오. –

0

RecyclerView 자체가 스크롤, 그래서 그냥 NestedScrollView

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal" 
    android:focusableInTouchMode="true" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" > 

    <TextView 
     android:id="@+id/textView" 
     android:textColor="#43a047" 
     android:typeface="serif" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:text="@string/app" 
     android:gravity="center" 
     android:textStyle="bold" 
     android:textSize="15sp" /> 

    <android.support.v7.widget.RecyclerView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/recyclerview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView" 
     android:layout_marginTop="5dp" 
     android:divider="@color/colorAccent" 
     android:dividerHeight="1dp" /> 

+0

그러면 툴바는 app : layout_behavior = "@ string/appbar_scrolling_view_behavior"를 스크롤하지 않습니다. – AndroidBeginnerJhon

관련 문제