1
後,我有一個RecyclerView
即顯示圖片,並且已經把FloatingActionButton
讓我的用戶返回到視圖的頂部像這樣:「返回頂部」按鈕只顯示滾動
// On FAB click, scroll back to the top of the layout
private void handleUp() {
FloatingActionButton FAB = (FloatingActionButton) view.findViewById(R.id.upFAB);
FAB.setOnClickListener(view1 -> {
if (recyclerView != null) {
recyclerView.smoothScrollToPosition(0);
}
});
}
有以下看法:
<android.support.design.widget.FloatingActionButton
app:fabSize="mini"
android:id="@+id/upFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/up_icon"
android:layout_gravity="bottom|center"
android:layout_marginBottom="60dp" />
看起來像this。
正如你可以看到按鈕會顯示所有的時間,請問有什麼可以只顯示它當用戶滾動一定量的RecyclerView
?