I need an android component that will hold two views (one on top, and the second one ont he bottom). There will also be a slider between views.
It will look something like this:
View 1 is bigger than shown and user can expand it by moving down the separator (dark grey rectangle on the picture above). While expanding, View 2 will go down and will not be covered by View 1 (not like in android's notification panel).
Is there some kind of ready to use library for this? If not - could you point me in the right direction how to achieve this?
I haven't done this but I think you can scale the view by draggin. see this to know about this method.
Your question is from years ago, but I've had the same problem recently. Now that we can do nice things with the Design library with scrolling and resizing, this question has become even more important.
So I'd like to point out a library called SubAppBarPanel, that allows you to expand an area from below the app bar. When it's expanded, it pushes down the main content (see GIF).
Related
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
The idea I'm having is having a view that can be pulled down on top of the current view, with similar animation features like the one you can pull down from the top all the time, on Android Devices.
Here's an illustration:
The idea is to grab it and being able to pull it down on top of the other view, and then being able to interact with that view. To slide it up again, you should grab the bottom of the view (the grey area in the illustration) again, and then pull it up.
I haven't even worked with animations before but I found a lot of topics on that, while searching for solutions to my problem, including this: Slide down view in android
but my impression is that, that is about making animations when the user isn't touching the phone.
What is the best way to do this?
Is there a better way to do something very similar?
EDIT:
Here's the topic that made me find the solution: How to make an Android SlidingDrawer slide out from the left?
And here's the solution I used:
SlidingDrawer Top-to-Bottom
You could use a SlidingDrawer, this is a built in component into Android, but as far as I know it slides only from bottom - up.
If you a comfortable to modify your app design, then this could be an option for you.
However, on internet are some libraries of custom SlidingDrawer that lets you put the marker on any side of your screen, so you can drag it top-down, left-right, right-left.. any way you want.
Useful links:
How to make an Android SlidingDrawer slide out from the left?
SlidingDrawer Top-to-Bottom
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
Is there a way to absolutely position an UI element on Android so that it is located outside an Activity? For example: can you create a fullscreen ImageView simply by moving/resizing an ImageView inside an existing regular Activity instead of creating a new fullscreen activity?
EDIT: Re-reading my question I see I wasn't very clear about what I'm trying to accomplish. I'd like to temporarily extend an element to cover the notification bar at the top of the screen. I need to create a semitranslucent fullscreen overlay but since translucent activities cannot cover the notification bar I'm trying to find out if it's possible for an element to break out of activity's bounds and resize itself to fill the whole screen, top to bottom.
That depends on what specifically you're trying to do. You can easily draw graphics offscreen and then animate their movement into the screen using a Canvas, but this is more for graphics than for user-interface elements. For moving buttons or such, you can have a look at another question here "How to position View off-screen". I gave a brief intro on how to use canvases, but the questioner found another way to do it using a customised linear layout and view animations.
Lastly, if you're trying to zoom and scroll an image around that's larger than the ImageView, there are some sources you can look at for inspiration. I realies this isn't strictly your question, but I'm including it since it might be linked to what you're thinking about. You can find a tutorial on Anddev.org and an open source app on Google Code.