开发者

Android Tweetdeck-like UI

I'm getting started with Android development, and I would like to have an interface similar to that of tweetdeck: there are several workspaces (activities) that are laid out left to right, and the user can switch between them with a horizon开发者_Python百科tal gesture. The same way the Android desktops are switched.

In tweetdeck there are also dots in the titlebar, that indicate on which side and how many workspaces there are.

Is it a standard Android interface, or something custom built? How do I do something like this?


How you go about this is going to be partially dependent on the content you want to present. If there are going to be many heavyweight pages you'll want to look into doing something like a custom AdapterView. If there are only a few fixed pages such as in the stock home screen you can treat it like a scrollable view with some custom logic to handle snapping to pages.

Here's a link to the custom view that implements this in the stock Android launcher. The bits you're interested in will mostly be in onTouchEvent, onInterceptTouchEvent, and computeScroll.

https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/Workspace.java


Take a look at ViewFlipper: http://developer.android.com/reference/android/widget/ViewFlipper.html


In addition to studying the actual Android code (referenced in another answer), some folks have extracted and isolated the workspace (Launcher2) code into a re-usable view group. You can find the work in github here https://github.com/olibye/AndroViews

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜