Android: “News and Weather” app tabs

◇◆丶佛笑我妖孽 提交于 2019-12-09 16:48:26

问题


does anyone know how to build that kind of tabs that the "News and Weather" app uses?

see here http://img51.imageshack.us/img51/8788/tabsd.png

This means a tab area that can be scrolled to the left & right. Changing the tabs is also possible by scrolling the listview to the left / right.


回答1:


That component up there is actually a HorizontalScrollView, with buttons inside. Use it like a LinearLayout and throw in the buttons. You'll have to manually handle the selected/unselected states of the buttons/tabs though.




回答2:


The tabs are quite easy to create, it's an horizontal scroll view with buttons as someone else already mentioned. The content part is the tough thing. It scrolls both horizontally and vertically, therefore requires some magic.




回答3:


Once you have the tabs, you can use an adaptation of WorkspaceView for the rest: Horizontal "tab"ish scroll between views

EDIT: This is now supported in the Android SDK. See here: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1



来源:https://stackoverflow.com/questions/4483623/android-news-and-weather-app-tabs

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