henrytao-me / smooth-app-bar-layout

Smooth version of Google Support Design AppBarLayout
Apache License 2.0
1.77k stars 240 forks source link

Not able to use appbar layout with recycler view #204

Open sekharrockz opened 7 years ago

sekharrockz commented 7 years ago
<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    >

  <android.support.v7.widget.RecyclerView
      android:id="@+id/detail_view_container"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginBottom="60dp"
      />

  <me.henrytao.smoothappbarlayout.SmoothAppBarLayout
      android:id="@+id/appbar"
      android:layout_width="match_parent"
      android:layout_height="465dp"
      app:sabl_target_id="@id/detail_view_container"
      >

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

      <FrameLayout
          android:id="@+id/details_fragment"
          android:layout_width="match_parent"
          android:layout_height="465dp"
          app:layout_collapseMode="parallax"
          />

      <android.support.v7.widget.Toolbar
          android:id="@+id/main_toolbar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          app:layout_collapseMode="pin"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
          />

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

  </me.henrytao.smoothappbarlayout.SmoothAppBarLayout>

  <LinearLayout
      android:id="@+id/bottomBar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:orientation="horizontal"
      android:visibility="gone"
      android:weightSum="2"
      >

    <RelativeLayout
        android:id="@+id/addToWishList"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_weight="1"
        android:background="@color/grey500"
        android:clickable="true"
        android:focusable="true"
        android:foreground="@drawable/ripple"
        android:orientation="horizontal"
        >
      <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:layout_centerVertical="true"
          android:orientation="horizontal"
          >
        <FrameLayout
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_gravity="center_vertical"
            android:layout_margin="5dp"
            >
          <ImageView
              android:id="@+id/like"
              android:layout_width="20dp"
              android:layout_height="20dp"
              android:src="@drawable/heart_selected_18dp"
              android:visibility="gone"
              />
          <ImageView
              android:id="@+id/dislike"
              android:layout_width="20dp"
              android:layout_height="20dp"
              android:src="@drawable/heart_outline_18dp"
              />
          <ProgressBar
              android:id="@+id/wishListProgress"
              android:layout_width="20dp"
              android:layout_height="20dp"
              android:visibility="gone"
              />
        </FrameLayout>
        <TextView
            android:id="@+id/addToWishListText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text="@string/add_to_wishlist"
            android:textColor="@color/white"
            />
      </LinearLayout>
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/visitStore"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_weight="1"
        android:background="@color/com_facebook_messenger_blue"
        android:clickable="true"
        android:focusable="true"
        android:foreground="@drawable/ripple"
        android:orientation="horizontal"
        >
      <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:gravity="center"
          android:text="@string/visit_store"
          android:textColor="@color/white"
          />
    </RelativeLayout>
  </LinearLayout>
</android.support.design.widget.CoordinatorLayout>
henrytao-me commented 7 years ago

Hi @sekharrockz

There are 2 issues in your code:

shubhamgupta9 commented 6 years ago

HI @henrytao-me i am getting app:sabl_target_id is not found error and i am using this library version implementation 'me.henrytao:smooth-app-bar-layout:24.1.0.0' and for app i am using this xmlns:app="http://schemas.android.com/apk/res-auto"

Please help me