0

레이아웃에서 recyclerview 대신 사용자 정의 빈보기를 추가 할 때 문제가 거의 없습니다. 내 사용자 정의 빈보기는 "center_vertical"로 중력 있습니다. 이처럼 이미지를 추가하면 사용자 정의 빈보기에 추가 된 텍스트가 listview가 표시된 영역 아래에 숨겨집니다. 화면에서 벗어납니다. SwipeRefreshLayout에 대한 "appbar_scrolling_view_behavior"때문에이 문제가 발생했다고 생각합니다. 하지만 목록이 스크롤되면서 Appbar가 스크롤되도록 스크롤해야합니다. 그러나 표시 할 데이터가 없으면 사용자 정의 빈보기의 이미지를 화면 중앙의 appbarlayout 아래에 표시하려고합니다. 현재 화면 아래쪽으로 밀려나고 있습니다.아래의 RecyclerView 대신 빈보기 추가 AppBarLayout

<?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" 
android:id="@+id/coordinatorLayout" 
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"> 

      <RelativeLayout 
      android:id="@+id/headRelativeLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:focusableInTouchMode="true" 
      app:layout_scrollFlags="scroll|enterAlways"> 

       <include 
       android:id="@+id/topLayout" 
       layout="@layout/top_sch_listview" /> 

       <include 
       android:id="@+id/msgLayout" 
       layout="@layout/view" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_below="@+id/topLayout" /> 

       <include 
       android:id="@+id/subHeaderLayout" 
       layout="@layout/view_sub_header" 
       android:layout_width="match_parent" 
       android:layout_height="@dimen/sub_header_height" 
       android:layout_below="@+id/msgLayout" /> 

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

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipeRefreshLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

      <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

        <android.support.v7.widget.RecyclerView 
        android:id="@+id/recyclerListView" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 

        <com.my.views.CustomEmptyView 
         android:id="@+id/empty" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" /> 
      </RelativeLayout> 
    </android.support.v4.widget.SwipeRefreshLayout> 

    <View 
    android:id="@+id/blankView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:visibility="invisible" /> 

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

내가 뭘 잘못하고 있는지 잘 모르겠습니다. 누군가 도울 수 있습니까?

감사합니다.

답변

-1

CustomEmptyView의 제거

recyclerListView 이 adpater에 ViewHoler의 설정

emptyView 홀더> (사용자 정의 빈보기)

DataView를 홀더> (RecycleView : 목록)

public class AdvancedItemAdapter extends MultiItemAdapter { 

public static final int VIEW_TYPE_EMPTY = 0; 
public static final int VIEW_TYPE_DATA = 1; 

@Override 
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 

    if (viewType == VIEW_TYPE_EMPTY) { 
     EmptyViewHolder holder = (EmptyTYpeViewHolder)viewHolder; 
     return holder; 
    } else { 
     DataViewHolder holder = (DataTYpeViewHolder)viewHolder; 
     return holder; 
    } 

} 
} 

데이터 배열 계산 확인

내가 그 일을 생각하지 말아 이전

setType (태그, viewholder 클래스에 입력 한 값)

어댑터 notifyDataSetChanged()

+0

을 notifyDataSetChanged. 그것은 같은 방식으로 행동 할 것입니다. – Neha

+0

나는 아직도 그것을 시도했다. 그러나 일하지 않았다. – Neha