开发者

Android UI question. Implementation guidance

开发者 https://www.devze.com 2023-03-08 13:02 出处:网络
I\'m working on implementing a UI for an Android application, and I wanted to ask if there is already something in the native widgets to accomplish most of what I\'m trying to do.

I'm working on implementing a UI for an Android application, and I wanted to ask if there is already something in the native widgets to accomplish most of what I'm trying to do.

The application that I'm working on performs 15 different tasks that can be divided into 3 different groups. (5 tasks per group) I have 18 icon images (3 for the groups and 15 for the individual tasks) an开发者_运维百科d I want to be able to panel these icons (starting with the groups) like this:

Android UI question. Implementation guidance

I want the next icon visible below and above (if further down than the first icon) and swipe to go to the next icon

Android UI question. Implementation guidance

Once an icon is clicked, the panels slide to the side, exposing the next layer (the specific 5 tasks for the selected group) with the selected group still visible on the side:

Android UI question. Implementation guidance

From there, the user can tell at a glance what group they are in, what the current, next and previous selectable tasks are, and that by swiping right, they can get back to the group selection.

What types of widgets would I need to look into in order to accomplish something like this? Are there already pre-built lists to do these activities?

Thanks for any guidance!


You can get close with a LinearLayout of ImageView widgets and a ScrollView (vertical) or HorizontalScrollView. However, it will not give you the desired "centered image with bits of the previous/next images" effect -- it will be wherever the user positions it.

You can get close with a Gallery. However, it will not give you the vertical orientation, and it will always give you a fixed set of full options to the sides, not the partial images that you seek.

If it's gotta be the way you describe it, you'll have to roll it yourself. Gestures and animations should give you the desired effect.


Have you taken a look at ViewFlipper? http://developer.android.com/reference/android/widget/ViewFlipper.html This will give the side by side effect but you will have to make custom views for each group to populate it with the proper icons.


I'd use a ListActivity for the first 3 top level items. This won't give you the auto centering effect that you'll probably want, but you should be able to look at the Gallery source code, which can be found here, and make some modifications to the ListActivity so that it autocenters.

For the next items, I'd add an onClick and a GestureListener so you can navigate to another activity with another list view. Since you know where you came from (add some data to your Intent) you can set the color rectangle on the left so that it appears that you have just swiped the whole view left.

If you need to customize the animation, you can call this:

overridePendingTransition(R.anim.slide_left_entry, R.anim.slide_left_exit);

To make the yellow icon look good as it animates to the left, I'd change the list bounds (on the first activity) to have no margins, and change the yellow icon to have square right edges - This will make the small yellow rectangle on the next activity appear to be part of the first activity.

It should be relatively easy to mock this up to see if it's going to work properly for you.

Good luck!

EDIT: Ok, so I've made a basic project that does most of what you want. here is the link to the eclipse project file. I was going to put the source up here, but there's a bit much to display.

What you still have to do:

  • Tweak animation
  • Configure the layer lists to display the correct colors
  • Add information to the top level intent for the sub-activity to be able to configure itself.
  • Quite a few other small things.

I think I've got the main stuff done. I've also added the gesture listener I talked about, although re-reading your question, you actually didn't ask for that. Since it's cool, I left it in.

Good Luck once again!!


Have you thought of launching Activities with different view configurations? You can switch from one activity to another with a gesture and you can Animate the views. What your UI looks like to me is a bunch of screens with affordances that show the other screens. So one Activity per screen maybe the same in different configurations or something like that.

0

精彩评论

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