2016-09-16 3 views
-2

ViewPagerNestedScrollViewRecyclerView을 사용했습니다. 모든 것은 잘 작동하고 있습니다. 리사이클 러 뷰가 먼저로드 된 다음, 페이저를 저크 (부드럽게 보이지 않음)로 볼 수 있고 화면이 좋지 않게 보이는 화면을로드하는 동안 예상대로 작동합니다.Nestedscrollview 및 Recyclerview가있는 ViewPager와 저크가있는 로딩

지금 당장 디자인 쪽에서보기 호출기 용 어댑터를 설정하지 않았습니다. 뷰 페이저 나 recyclerview가 아닌 ​​데이터를 채우지 않았습니다.

XML을 :

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 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" 
android:orientation="vertical"> 

<hammerapps.views.CustomNestedScrollView 
    android:id="@+id/scroll_main" 
    android:layout_width="match_parent" 
    android:layout_gravity="fill_vertical" 
    android:layout_height="match_parent" 
    android:fillViewport="true"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/white" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="200dp" 
      android:orientation="vertical"> 

      <android.support.v4.view.ViewPager 
       android:id="@+id/pager_banner" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@color/gray_bg" 
       /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="24dp" 
      android:orientation="horizontal" 
      android:visibility="visible"> 

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

       <hammerapps.views.TextViewKarlaRegular 
        android:id="@+id/txt_cat_title" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="left" 
        android:layout_marginTop="4dp" 
        android:text="EXPLORE" 
        android:textColor="@color/blue_color" 
        android:textSize="14dp" /> 

       <android.support.v7.widget.RecyclerView 
        android:id="@+id/recycler_home_explore" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="16dp" /> 
      </LinearLayout> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dp" 
      android:orientation="vertical" 
      android:visibility="visible"> 

      <hammerapps.views.TextViewKarlaBold 
       android:id="@+id/txt_cat1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="left" 
       android:layout_marginLeft="16dp" 
       android:text="EXCLUSIVE" 
       android:textColor="@color/blue_color" 
       android:textSize="14dp" /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@color/border_yellow" 
       android:orientation="vertical" 
       android:layout_marginTop="16dp" 
       android:visibility="visible"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_marginBottom="16dp" 
        android:orientation="vertical"> 

        <android.support.v7.widget.RecyclerView 
         android:id="@+id/recycler_home_exclusive" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:visibility="visible" /> 
       </LinearLayout> 
      </LinearLayout> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="30dp" 
      android:layout_marginBottom="16dp" 
      android:orientation="vertical"> 

      <hammerapps.views.TextViewKarlaBold 
       android:id="@+id/txt_get_social" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="left" 
       android:text="GET SOCIAL" 
       android:textColor="@color/blue_color" 
       android:textSize="14dp" /> 

      <hammerapps.views.TextViewKarlaBold 
       android:id="@+id/txt_twicestyle" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="left" 
       android:layout_marginTop="8dp" 
       android:text="\@twicelifestyle \#twicelifestyle" 
       android:textColor="@color/orange" 
       android:textSize="12dp" /> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/recycler_home_get_social" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:visibility="visible" /> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/lin_footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:gravity="bottom" 
      android:orientation="horizontal" 
      android:weightSum="10"> 

      <hammerapps.views.TextViewKarlaRegular 
       android:id="@+id/txt_view_gallery" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="4" 
       android:background="@color/blue_light_bg_color" 
       android:gravity="center" 
       android:padding="16dp" 
       android:text="VIEW GALLERY" 
       android:textColor="@color/white" 
       android:textSize="12dp" 
       /> 

      <hammerapps.views.TextViewKarlaRegular 
       android:id="@+id/txt_upload_pic" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="6" 
       android:background="@color/red" 
       android:gravity="center" 
       android:padding="16dp" 
       android:text="UPLOAD YOUR PICTURE" 
       android:textColor="@color/white" 
       android:textSize="12dp" /> 
     </LinearLayout> 
    </LinearLayout> 
</hammerapps.views.CustomNestedScrollView> 

</FrameLayout> 

문제 :

enter image description here

+0

자바 코드를 게시하십시오. 그것은 당신의 질문에 충분하지 않습니다. –

+0

뭘보고 싶니? 나는 이미 내가보기 호출기에 대해 아무 것도 설정하지 않았다고 말했다. – Piyush

+0

만약 내가 잘못하지 않았다면 스플래시 화면이 없어 졌을 것이다. 맞지? –

답변

4

마지막으로 나 자신과 대답을 얻었다!

사용자 정의 NestedScrollView을 구현했으며이 두 가지 방법을 오버라이드하고 매력처럼 작동합니다!

@Override 
public void requestChildFocus(View child, View focused) { 
    Log.d(getClass().getSimpleName(), "Request focus"); 

} 

@Override 
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) { 
    Log.d(getClass().getSimpleName(), "Request focus descendants"); 
    //return super.onRequestFocusInDescendants(direction, previouslyFocusedRect); 
    return false; 
}