0
我想實現包含物品的Recyclerview,並且在包含3個按鈕的屏幕底部有一個佈局,並且我想讓它消失或者一旦開始滾動RecyclerView就將其向下滑動。我搜索了很多,找不到任何關於這個......我知道如何實現摺疊工具欄佈局,但有沒有什麼訣竅如何做到底部佈局。在Recyclerview中向下滾動時,會使佈局向下/向外滑動?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/c2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rvContacts"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
fab:menu_backgroundColor="#ccffffff"
fab:menu_fab_label="Menu label"
fab:menu_icon="@drawable/filter2"
fab:menu_labels_ellipsize="end"
fab:menu_labels_singleLine="true">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/aa"
fab:fab_label="Menu item 1"
fab:fab_size="mini" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/aa"
fab:fab_label="Menu item 2"
fab:fab_size="mini" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/aa"
fab:fab_label="Menu item 3"
fab:fab_size="mini" />
</com.github.clans.fab.FloatingActionMenu>
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#e7e7e7"
android:gravity="bottom"
android:orientation="horizontal"
android:weightSum="3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/allbrands"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="All Brands"
android:textSize="10dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.8">
<ImageView
android:id="@+id/brandsearch"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerInParent="true"
android:src="@drawable/search01"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.2">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:text="Search Brands"
android:textSize="10dp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/allposts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="All Posts"
android:textSize="10dp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
您在哪裏定義視圖以隱藏?我無法找到它.... plzz告訴我.. –
裏面的活動或片段使用FindViewById並初始化視圖....這裏的視圖代表你想隱藏的按鈕 –
我編輯了'hideViews()'方法 –