[英]How to show view while scrolling and hide view after scrolling stop in android
我有一個線性布局視圖,在布局的底部帶有一些按鈕。布局包含許多元素,因此我添加了scrollview以顯示所有內容。
現在,當我向上或向下滾動時,我想隱藏我的底部線性布局內容,並且當用戶停止滾動列表視圖時,我想再次顯示它。
誰能建議我一些解決方案來實現這一目標。 任何幫助都是適當的謝謝
您可以嘗試實現ScrollView
OnScrollListener
。 它有一個方法:
/**
* Callback method to be invoked while the list view or grid view is being scrolled. If the
* view is being scrolled, this method will be called before the next frame of the scroll is
* rendered. In particular, it will be called before any calls to
* {@link Adapter#getView(int, View, ViewGroup)}.
*
* @param view The view whose scroll state is being reported
*
* @param scrollState The current scroll state. One of {@link #SCROLL_STATE_IDLE},
* {@link #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}.
*/
public void onScrollStateChanged(AbsListView view, int scrollState);
滾動狀態更改時,可以將setVisibility()
設置為要顯示/隱藏的Button
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.