I am using ViewFlipper to navigate between screens. Each screen has 4 images in a grid. How to have similar functionality that is present on android home screen and application menu screen where user can quickly navigate to a page by pressing circle shaped buttons on top of screen. What I should use to have this effect? Thanks in advance.
I would switch to using a ViewPager, available in the Compatibility Library: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Then you can use the ViewPagerIndicator library to achieve the effect that you're looking for (as well as giving you the choice of other styles of indicators): https://github.com/JakeWharton/Android-ViewPagerIndicator
Here is the example code: Circle Flow Indicator
Using this you will get output:
Related
I am building an app like uber, I have problems with some concepts I don't know.
How to make the animation when a view is swiped from bottom to top, it will merge with the toolbar until then the view is in a activity.
How to maintain or load the same map in all activities of the app.
Note: I don't know if the Uber app uses activities, fragments or otherwise.
Image: Picture before you start sliding
Image: Activity merged with the toolbar
For swipe a view from bottom to top, you can use bottom sheet android component which presents a dismissible view from the bottom of the screen and for animation you can define translation or transition animation for the component. Here is one github repository.
With regards,
Better yet, try using bottomSheetDialogFragment. though what i cant say is if it will give you a fullscreen merge with the other activity but it has features like drag already implemented. Here is a link to a tutorial you can follow
I see in many apps this way to navigate on Android as you see in the image below . When the screen is touched switch to the next screen and the blue circles below turn orange but i dont know how to do it. is it a library?
See ViewPager (http://developer.android.com/design/patterns/swipe-views.html) for the swipe navigation, and PagerTabStrip (http://developer.android.com/reference/android/support/v4/view/PagerTabStrip.html#).
I'm using the slide menu library and setting the menu offset from a xml.
setBehindOffsetRes(R.dimen.slidingmenu_offset);
when I click the menu item I use
menu.toggle(true);
which moves the content to left with menu behind it. My scenario is when I click the menu item, the content has to move all the way to right and then should bring the content in like the normal way so that the user dont get to see the UI change. I used
setBehindOffsetRes(R.dimen.slidingmenu_fullscreen);
showMenu(true);
where R.dimen.slidingmenu_fullscreen = 0dp. The menu goes to full screen behind the content, but the content doesn't moves to the right. Thanks in advance!
Edit 1: This is similar to Xoom application... Sample "Slide Sample"
I would recommend using ActionBarSherlock. Use this tutorial for sliding menu, It is much easier to use, and you will find much more help with it. It is also more compatible with different screen sizes, and more Android versions.
Finally I figured it myself.
menu.mViewAbove.scrollTo(menu.mViewAbove.getScrollX()-200,0);
moved the content to right. But now got into another problem. which I have descibed here->
https://stackoverflow.com/questions/19714871/sliding-menu-move-content-to-right
The SlidingMenu library is an excellent third party library and I've already used it for a long time. Now I know Android provides a new navigation pattern using Navigation Drawer. It looks like the sliding menu. So is there anyone who already uses these two both? What is the difference and what are the pros and cons? Thanks a lot.
SlidingMenu library is a third party api which uses a RelativeLayout inside. The main advantage is customization according to your requirement. Buy your layouts have to be based on a viewgroup, unfortunatly this negates the <merge> optimisations.
Navigation Drawer is available in the Support Library of android it uses DrawerLayout inside. The main advantage is improved performance.
They also have different visual effects. SlidingMenu looks like horizontal scroll view. Sliding it in will push the main content out.
Pros :
It comes with cool entrance / exit animations for the menu content.
Depending on what Activity you use it on, it can be placed below the Action Bar or next to it (pushing the Action Bar too)
You can explicitly set the touch mode via a setter: margin or full screen. In full screen mode touching anywhere on the screen will open the menu. In margin, only when you slide from the edge of screen will the menu open.
Cons :
You can only control the shadow of the side menu
Navigation Drawer / Drawer Layout looks like an additional top level view in a frame layout. Sliding it in will mask the main content.
Pros :
If you use v4 support lib then it's already there.
You can control both the side menu shadow and obscure the main
content via setScrimColor e.g when the drawer is opened, a fade-in
alpha layer will appear above the main content. This is good to visually separate the content and the menu especially when both have a same color.
Cons:
It can only be placed below ActionBar
There is no setter for touch mode and by default you can only do margin touch mode. Doing a full screen touch mode (like Youtube) involves a lot of work
I think the best advantage is that It is official Google code, I mean it just works and works excellent.
The main disadvantage is that it is very basic to use, I mean... you cannot put two navigation drawer in the same activity or fragment, you can only use one in left and that's it.
You already said it yourself. Sliding menu is third party. Navigation drawer is official. Both have the same purpose, but third party libraries might implementing it slightly differently, depending on which one you use.
I am developing an app on Android and would like to use the similar menu bar like Google Plus or Facebook, when you click the button, the menu bar will slide in and will not occupy the whole screen. Any ideas on that?
Thanks.
A pretty popular library for accomplishing the 'sliding menu' effect (or 'drawer' as the design guidelines on the Android developer website prefer to call it) is Jeremy Feinstein's SlidingMenu. It's also compatible with ActionBarSherlock, in case your project is using that too. Unfortunately, at this stage there is no component built into the SDK that allows you to do easily accomplish the same thing.
There are also a couple of alternative implementations for a sliding menu (do a search either here on SO or Google), but I haven't checked those out for a little while. If I recall correctly, there are especially some variations in terms of whether the ActionBar is supposed to slide along with the content or stay fixed at the top of the screen.
You can use FrameLayout in parent view and use translate animation in menu layout to show the slide in and slide out effect.