3

とツールバーを折りたたむ:は私が達成したい何tablayout

enter image description here

このUIのデザインは、私が

enter image description here

持っているものAudio Beats

、ここに属します。問題は、ツールバーが折りたたまれているときに、recyclerViewの背後にあるtablayoutです。また、タイトル「Musico」を削除することも、スティッキーとしてトップに設定することもできません。

私のXMLは、助けてください

<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.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="200dp" 
    android:fitsSystemWindows="true" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     app:contentScrim="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     > 

     <ImageView 
      android:id="@+id/backdrop" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/hp" 
      app:layout_collapseMode="parallax" 
      /> 
     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:layout_collapseMode="pin" 
      android:layout_width="match_parent" 
      android:layout_height="90dp" 
      app:popupTheme="@style/AppTheme.PopupOverlay" > 

     </android.support.v7.widget.Toolbar> 
     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      app:tabGravity="center" 
      android:layout_gravity="bottom" 
      app:tabMode="scrollable" /> 
    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 
<include layout="@layout/content_main"/> 
</android.support.design.widget.CoordinatorLayout> 

とcontent_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_main" 
app:behavior_overlapTop="30dp" 
> 

<android.support.v4.view.ViewPager 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/view_pager" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp"></android.support.v4.view.ViewPager> 
</RelativeLayout> 

です。

答えて

1

をインターネット上でしばらく検索した後私はGitHub上で私が望むのと同じ機能を提供するMaterial View Pager by Florent37を見つけました。

-2

タブレイアウトに30dpの余白を付け、必要に応じてappbarレイアウトのサイズを増やすだけです。

+0

動作しません。ビューが完全に折りたたまれている場合、余白は変わりません。 –

+0

TabLayoutをview_pagerの上に透明な背景を持つcontent_main.xmlの中に配置すると分かりますか?この問題は修正されますか? – Nivedh

+0

Y..私もそれを試しましたが、出力はかなり似ていましたが、最初のgifで言及したのと同じではありませんでした。全体的にこれはやはり解決策ではない。 –

0
ツールバーへのTextView(MUSICO)内を移動し、ツールバーのカスタムレイアウトを提供

レイアウトが正しくありません(それが一番上まで残ります) 参照してください:CollaspingLayoutwithviewpager

+0

まず、Musicoはテキストビューではありません。わかりません。ツールバーのタイトルまたはcolapsingToolbarLayoutです。しかし、私はそれらのいずれかにタイトルを設定しません。それはアプリケーション名です。第二に、私は既にリンクを訪問し、それはツールバーを折りたたむ単純なtablayoutを持っています。しかし、最初のgifで示したようなカスタムビューが必要です。 –

関連する問題