开发者

Android: "News and Weather" app tabs

开发者 https://www.devze.com 2023-01-31 13:15 出处:网络
does anyone know how to build that kind of tabs that the \"News and Weather\" app uses? see here http://img51.imageshack.us/im开发者_运维技巧g51/8788/tabsd.png

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

see here http://img51.imageshack.us/im开发者_运维技巧g51/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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号