Currently I'm developing a small app for my parents' business. I'm trying to create a custom menu. I'd like to have something similar to this:
If you look at it, the screen is divided in two sections. The upper section is just an image and the lower section is the menu. I'd like to achieve this:
If the user places his finger over an item of the menu and swipes to the right, all the items move one position right, and the opposite if the user swipes left.
I'm quite new in this field and I'm not looking for a piece of code. I just want some tips on what to search because I don't know even where to start.
Thanks a lot!
By what I understood, ViewPager should be able to solve your problem. You hsve it nested in your layout under the main image. Have a look here: http://developer.android.com/training/animation/screen-slide.html
Related
I need to make a layout similar to that Image.
I wish it were shown all the registered images and their attributes and a button to add the user would select an image and define the attributes of it. I do not want a complete example that ordered but at least one direction than I use to do the layout. By my research I should perhaps use a swipe view. Has anyone seen something similar?
Thank you
You can use ViewPager to display cards like in top part.
ViewPager with previous and next page boundaries
And use a ListView or RecyclerView to show the bottom part. https://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465
I am trying to implement a simple tree-like menu. I have a ListView as the root. Each item is a custom View that consists of an arrow icon at the right if it has a submenu and a checkbox taking up the rest of the row. This is all great.
Now here is what I want to do and can't figure out how (I am new to Android, but Googling didn't help me):
If the user slides to the left on an item with an arrow, the whole list will slide out to the left and the corresponding submenu will slide in from the right. If the user slides to the right anywhere on the menu, the whole menu will slide out to the right and the parent menu will slide back in from the left. When you picture it it is really a simple concept.
My problem seems to be double:
I can't figure out how to capture a sliding motion. I assume there is some onSlide event or some such, but I can't find it.
I can't seem to attach events to the individual items. I tried just a simple toast with the onItemClickListener and couldn't get it to fire.
Any help or reference would be appreciated.
For the Sliding, check out the ViewPager class and the matching Adapter class, but generally what you describe sounds a lot like iOS and you should rather not try to duplicate a behaviour that's alien to Android users.
I'm new programming in Android and i have many doubts about what type of classes can i use in my first app.
I want to do a level menu like cut the rope or angry birds. Only a title and a slider menu.
I think that can do with the two classes, but I'm not sure which is better, can you tell me the difference and which is better to use?
Many thanks.
ViewPager allows you to flip between pages of data (between views). You supply an adapter to generate the pages that the view shows.
But HorizontalScrollView is a container for other views that you can scrolled through, allowing it to be larger than the physical display.
I would go with horizontal scroll view.
EDIT : See FoamyGuy's answer in Angry Birds like scrolling menu where he exactly explains how to achieve such effect.
Here is what I wish to implement..
A slider like thing...
Say My app is a game with 4x4 array of level buttons in each screen
and there are totally 3 screens...
The user should be able to swipe his finger from right to left and the
slider should "slide" to next 4x4 set of levels...
Just like what the phone functions while we open apps from homescreen. And if the user swipes his finger from right to left and there are no levels to the left, the slider should bounce back...
So... What I ask is which layout/view/class to use to implement such a slider?
Also, plz inform me how can I implement such a slider which switches between tabs as well (each tab containing different layouts).. I hope I made myself clear...
As i understand you can use:
gallery and for each row create your own viw
ViewPager - like in android market (slide between view)
All of this approaches uses adapters and listeners - you can find a lot of examples in internet. I think in your case viewPager is mor useful, because as i understand you want to have many different views.
I'm trying to add some arrows to the screen to indicate if there are items available to the left or right so that the user knows to scroll.
Initially I just added these images into the instantiateItem function in the pageradapter. However I want to animate the arrows so that they fade in and out and disappear when the user touches the screen.
I've started to think that I may be best off extending the viewpager class so that it always displays the arrows independently of the adapter. I've looked through the code but can't see a place where I would add the overlay view.
Has anyone got any ideas?
Thanks,
m
As suggested by CommonsWare
You might wish to take a look at github.com/JakeWharton/Android-ViewPagerIndicator and see how Jake did it.
this information lead me to the solution.