I am working on an app in which i want to swipe image horizontally and while making swiping to half it would do some action and it would regain its original position. this is to be done in both ways left and right swipe.for an example gmail app uses this, in which when we swipe it half and left it, it will regain its same position. but in similar terms i also want to make some function call. please suggest me what to do.
for this i have tried something swipe features but i am not getting it properly.
If I got ur question correct, this is the solution
http://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging
I have an activity that must be used horizontally.
this activity shows a map and when i click on it a toolbar supposed to pop from the right side of the screen (which is actually the bottom if we are looking vertically).
(Sorry for posting link instead of image, reputation doesn't allow me images)
http://i60.tinypic.com/xlb12g.jpg
i thought of implementing this toolbar as a container of fragments because each button triggers different stuff to appear on the toolbar.
First of all, is it the best way to implement such a toolbar? or are there more android oriented ways?
Second, i would like that when i touch the "transparent" space under the X button it would send this signal to the map but when i touch the "black transparent" it will not.
From what I've read the only way is when clicking check coordinates and see of they fall inside my area but it sounds too hardcoded and ugly solution.
Is there a better one? maybe there is a way to make the holding layout fit the image and not be rectangular?
For a more android oriented way you can use the Navigation drawer.
I don't know if it fit exactly with what you want but Navigation drawers are a good way to create right or left menu/toolbar.
You can find the documentation here:
https://developer.android.com/design/patterns/navigation-drawer.html
http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
I am able to implement slide drawer from right to left with one handle. I would like to have two handles (one below the other) and load different content.
I am facing the issue like both the handles are getting displayed at the same location, so that I am able to see only one handle.
How can I arrange these two handles ? I appreciate the earlier response.
Thanks, VK
Try next widget
https://github.com/xPutnikx/SlidingDrawerWithButtons
make it left to right, or another directions. It is also possible to add a few buttons in the handler
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) and I want to be able to panel these icons (starting with the groups) like this:
I want the next icon visible below and above (if further down than the first icon) and swipe to go to the next icon
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:
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.
I found a nice feature in Dolphin browser that brings another window from the side on a side-swipe. It's like the window is connected and revealed by swipe. See image below. Anyone knows how it is done?
I might be wrong but my guess would be they use a SlidingDrawer set to a lanscape orientation in a portrait layout (so it comes from the side rather than the top/bottom).
EDIT: Ok, I see now - I was rushing to go to work and didn't pick up on the fact the left hand side is displaced.
I suppose you could use two opposing SlidingDrawer views and force one to be initially open and the other initially closed. If their 'handle' views were identical and overlapped, then the effect would be similar to what you are seeing.
I'm not sure if the 'purists' would approve as the SlidingDrawer is meant to be used in an overlay fashion, i.e., it is meant to cover an existing view rather than to appear to move another out of the way. Then again, I've been coding for many years and often go on the principle that if it works why not use it?
Alternatively, there is some example code on smooth horizontal view scrolling in the answer to this question if it is of use. Horizontal Scrolling with fling gesture - ebook reader