CollapsingToolbarLayout mit Tablayout & Bild als kollabiert mit klebriger Symbolleiste

Ich möchte eine Ansicht ähnlich wie unten Bilder zu erreichen

Initiale Ansicht, die ich in meiner App benötige

Nach dem Start des Benutzerfensters sollte die Ansicht nach unten angezeigt werden

Unten sind die Bildschirme, die ich durch Design-Support-Bibliothek in Android erreicht habe

Ansicht habe ich mit dem erwähnten xml erstellt Wenn ich rolle, versteckt man die tablayout was nicht gut ist

Bitte sehen Sie meine Layout-Datei unten

<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.CoordinatorLayout android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsingToolbarLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="64dp" android:fitsSystemWindows="true" 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/imageburger" app:layout_collapseMode="parallax" /> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="50dip" android:layout_below="@+id/toolbar" android:layout_gravity="bottom" android:gravity="bottom" app:layout_collapseMode="pin" app:tabGravity="center" app:tabMode="scrollable" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> </FrameLayout> 

Bitte überprüfen Sie die oben genannten xml und lassen Sie mich wissen, was ich falsch mache?

  • Toolbar Navigation Hamburger Icon fehlt
  • Erstellen einer Android-App mit targetSdkVersion von 25 und minSdkVersion 19
  • Bei der Verwendung der CoordinatorLayout hat meine ScrollView eine falsche Größe
  • Android TimePickerDialog Material Design Farbe
  • Warum gibt es verschiedene Gelegenheiten für aktive und inaktive Ikonen im Materialdesign?
  • Wie man den gemeinsamen Elementübergang mit Fragmenten startet?
  • Android-Dropdown-Schaltfläche
  • Android Activity Übergänge mit Support v4 up to date mit Android L
  • 3 Solutions collect form web for “CollapsingToolbarLayout mit Tablayout & Bild als kollabiert mit klebriger Symbolleiste”

    Bitte überprüfen Sie Paul Burke Gists, kann es Ihr Problem lösen,

    https://gist.github.com/iPaulPro/1468510f046cb10c51ea

    Ich habe es geschafft, mit diesem Beispiel zu arbeiten. https://github.com/vitovalov/TabbedCoordinatorLayout .

    Mein Code sieht jetzt so aus:

     <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/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:theme="@style/AppTheme.Trans"> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:fitsSystemWindows="true"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:minHeight="150dp" app:layout_scrollFlags="scroll|exitUntilCollapsed" android:fitsSystemWindows="true" app:expandedTitleMarginStart="48dp" app:expandedTitleMarginBottom="60dp" app:expandedTitleMarginEnd="64dp"> <FFImageLoading.Views.ImageViewAsync android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="240dp" android:scaleType="centerCrop" android:fitsSystemWindows="true" app:layout_collapseMode="parallax" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="100dp" android:gravity="top" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:layout_collapseMode="pin" app:titleMarginTop="15dp" /> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@drawable/gradient" app:tabIndicatorHeight="3dp" android:layout_gravity="bottom" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> 

    Bildbeschreibung hier eingeben

    Sie können versuchen, soucecode ex

      <?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" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <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:fitsSystemWindows="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true"> <android.support.design.widget.AppBarLayout android:id="@+id/appBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <LinearLayout android:id="@+id/vUserProfileRoot" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:clipChildren="false" android:clipToPadding="false" android:orientation="vertical" android:paddingBottom="24dp" android:paddingLeft="24dp" android:paddingRight="24dp" android:paddingTop="60dp" app:layout_collapseMode="parallax"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="false"> <ImageView android:id="@+id/ivUserProfilePhoto" android:layout_width="70dp" android:layout_height="70dp" android:background="@drawable/vdo" android:scaleType="centerCrop" android:adjustViewBounds="true" android:layout_marginRight="16dp" /> <LinearLayout android:id="@+id/vUserDetails" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <LinearLayout android:id="@+id/vUserStats" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="16dp" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1167" android:textColor="@color/black" android:textSize="20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="videos" android:textColor="@color/black" android:textSize="12sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="396" android:textColor="@color/black" android:textSize="20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="followers" android:textColor="@color/black" android:textSize="12sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="485" android:textColor="@color/black" android:textSize="20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Student" android:textColor="@color/black" android:textSize="12sp" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="218dp" android:layout_gravity="center" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:id="@+id/btnFollow" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_marginTop="8dp" android:scaleType="center" android:background="@drawable/image_btn_follow_src" /> <ImageButton android:id="@+id/btn_report" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="fitCenter" android:layout_gravity="center" android:layout_marginLeft="20dp" android:background="@drawable/report_btn" /> </LinearLayout> </LinearLayout> </LinearLayout> <TextView android:layout_marginTop="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I stuck in problem I have one project which uses JNI libs but when I use in another project it throws error unable to find jni" android:textColor="@color/black" android:textSize="15dp" /> </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/rvUserProfile" android:layout_width="match_parent" android:layout_height="match_parent" /> <include android:id="@+id/new_conn" layout="@layout/custom_profile_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.design.widget.CollapsingToolbarLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="48dp"> <it.neokree.materialtabs.MaterialTabHost android:id="@+id/tabHost" android:layout_width="match_parent" android:layout_height="48dp" app:tabGravity="fill" app:tabIndicatorColor="@color/black" app:primaryColor="@color/white" app:textColor="@color/black" app:accentColor="@color/gray" app:tabIndicatorHeight="4dp" app:tabMode="fixed" /> <!--<it.neokree.materialtabs.MaterialTabHost--> <!--android:id="@+id/tabHost"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="48dp"--> <!--android:layout_gravity="bottom"--> <!--android:layout_marginTop="15dp"--> <!--app:layout_scrollFlags="enterAlways"--> <!--app:tabBackground="@color/white"--> <!--app:tabGravity="center"--> <!--app:tabMode="scrollable"--> <!--app:tabSelectedTextColor="@color/white"--> <!--app:tabTextColor="@color/gray" />--> </FrameLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> </RelativeLayout> 

    Sie müssen herunterladen ex: https://github.com/kanytu/android-parallax-recyclerview

    https://github.com/Frank-Zhu/PullZoomView

    Das Android ist ein Google Android Fan-Website, Alles ├╝ber Android Phones, Android Wear, Android Dev und Android Spiele Apps und so weiter.