Android google-play-liked listview

谁都会走 提交于 2020-01-06 19:28:04

问题


Im new to android and practicing with an UI like googleplay apps, this is default view of the list :

when i scroll the list view up , the action bar got scrolled up and disappeared , basically my English is too bad and i dont know how or which keyword i must use in google search to get the result like this (as you see it looks like the action bar is inside the listview )

please show me how or give me an example to learn, thank you !


回答1:


you can define your layout structure like following :

<FrameLayout>

    <GridView or RecyclerView/>

    <MenuBar id="menuBar2" visibility="gone"/>

</FrameLayout>

to making the grid be able to scroll with the TitleBar and MenuBar, we should add a Header with GridView, of course RecyclerView would be easier to do this than GridView. the Header layout's structure would be like this :

<LinearLayout orientation="vertical">

    <TitleBar/>

    <MenuBar id="menuBar1"/>

</LinearLayout>

Once the menuBar1 fully scroll off to invisible, display the menuBar2, also synchronizing the menu state between both. The menuBar2 will appearing on top of that LinearLayout. when user scrolling to top and the menuBar1 just visible, hide the menuBar2.

how to determine if a View is fully invisible? the View.getLocalVisibleRect() would tell for this.




回答2:


Check How do the animation hiding the ActionBar and keeping tabs?

It suggests that you use https://github.com/ksoichiro/Android-ObservableScrollView.



来源:https://stackoverflow.com/questions/26667235/android-google-play-liked-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!