2017-08-02 6 views
0

I一つの活性CoordinatorLayoutツールバーは、リサイクルビューのスクロールで隠れていません

public class ResourceListActivity extends AppCompatActivity { 
    private ActivityResourceListBinding mBinding; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     mBinding = DataBindingUtil.setContentView(this, R.layout.activity_resource_list); 
     getWindow().setStatusBarColor(ContextCompat.getColor(getBaseContext(), R.color.colorPrimary)); 
     getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
     getSupportActionBar().setElevation(0f); 
     RecommendResourceFragment fragment = RecommendResourceFragment.newInstance(mColumnCount); 
     FragmentManager fragmentManager = getSupportFragmentManager(); 
     FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); 
     fragmentTransaction.replace(R.id.container_main, fragment); 
     fragmentTransaction.commit(); 
    } 
} 

レイアウトファイルをそのまま持っている:activity_resource_list.xml

<layout 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"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context="in.securelearning.lil.android.resources.view.activity.ResourceListActivity"> 

     <RelativeLayout 
      android:id="@+id/container_main" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/colorWhite" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

    </LinearLayout> 
</layout> 

そしてRecommendResourceFragment.javaフラグメントレイアウトは以下の通りです:

<layout> 

    <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:orientation="vertical"> 


     <android.support.design.widget.TabLayout 
      android:id="@+id/tabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:elevation="4dp" 
      android:background="@color/colorPrimary" 
      app:layout_collapseMode="parallax" 
      app:tabGravity="fill" 
      app:tabMode="scrollable"/> 


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

</layout> 

レイアウトのすべてのページで、水平タブが埋め込まれた状態でレンダリングされます。

<layout xmlns:app="http://schemas.android.com/apk/res-auto"> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/colorBackground" 
     android:orientation="vertical"> 

     <HorizontalScrollView 
      android:id="@+id/hlistview" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="none"> 

      <LinearLayout 
       android:id="@+id/imageview_holder" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 

      </LinearLayout> 

     </HorizontalScrollView> 

     <FrameLayout 
      android:id="@+id/list_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:visibility="visible"> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/video_list" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_marginTop="10dp" 
       android:alwaysDrawnWithCache="true" 
       android:animationCache="true" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior" 
       android:drawingCacheQuality="high" 
       app:layout_collapseMode="parallax" 
       android:scrollbars="vertical"> 
      </android.support.v7.widget.RecyclerView> 

      <LinearLayout 
       android:id="@+id/layoutBottomProgress" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom|center" 
       android:gravity="center_horizontal" 
       android:orientation="vertical" 
       android:visibility="gone"> 

       <ProgressBar 
        android:id="@+id/progressBarBottom" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"/> 

       <in.securelearning.lil.android.base.widget.TextViewCustom 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="center_horizontal" 
        android:text="Hold on !\nLoading more videos..." 
        android:textSize="16sp" 
        android:visibility="gone"/> 

      </LinearLayout> 

      <ProgressBar 
       android:id="@+id/progress_bar" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center"/> 

     </FrameLayout> 

     <LinearLayout 
      android:id="@+id/layoutNoResult" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="center_horizontal|center_vertical" 
      android:orientation="vertical" 
      android:visibility="gone"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/logo_assignment" /> 

      <in.securelearning.lil.android.base.widget.TextViewCustom 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dp" 
       android:text="@string/string_no_results_found" 
       android:textSize="20sp" /> 

     </LinearLayout> 

    </LinearLayout> 

</layout> 

私はアプリを適用していますlayout_behavior =「@文字列/ appbar_scrolling_view_behavior」が、すべてのステージの上にツールバーが隠れていません。 提案があります。前もって感謝します。

答えて

0

は、あなたのツールバーに

app:layout_scrollFlags="scroll|enterAlways|snap" 
+0

をツールバーに追加します。したがって、提案された行を追加することはできません。 – Teekam

+0

@Teekamあなたはデフォルトでそれを使用することができます –

+0

どうすればいいですか? – Teekam

0

を次の行を追加してみてください、私はカスタムツールバーを使用していない

app:layout_scrollFlags="enterAlways" 
+0

私はカスタムツールバーを使用しません。私はデフォルトのツールバーを使用しています。ツールバーに推奨行を追加することはできません。 – Teekam

+0

ツールバーが便利です。あなたはそれを使うべきです。 –

+0

Androidはデフォルトのツールバーを提供しています。なぜカスタムを使用する必要がありますか?このようなことをする方法は他にありますか? – Teekam

関連する問題