I Build a Custom Launcher.
The launcher is made of views (each view will contain applications, images etc..)
The user can switch between those views in the home screen (almost like in every other laucncher)
the big difference is that in the launcher i build, when the user is in a specific view, he should be able to see the edges of the prev and/or the next view (if those are exist)
I tried to implement it by having a Horizontal Linear layout that holds the views.
It performs pretty nice, but not smooth enough.
I Concidered using viewflipper, but the problem with it, is that i can't see the prev and the next view.. (am i right?)
How should i implement this system?
thanks
Try to use ViewPager (android.support.v4.view.ViewPager). You need to download this .jar file to use it. http://developer.android.com/sdk/compatibility-library.html
Gallery already does this. It has issues with the smoothness and predictability of the left/right scrolling, but it will easily show your central view and the edges of the two neighboring views.
Related
You usually traverse a list by scrolling through the views that are placed one after another. What I'm trying to achieve is similar, but the views would be stacked on top of each other. The views will also cover the whole screen. So when you scroll, the top view slides away (or uses some other transition animation), but the bottom one is not moving underneath. You can imagine that the views are like the papers in a top spiral-bound notebook.
So my question is - does something similar already exist? I haven't been able to found anything so I might need to make a custom implementation. Oh and the views will each contain an image and there might be quite a few of them, so it will need to handle that (I was thinking of using Android Universal Image Loader). Thanks.
Sounds like you want to use Depth page transformer, via http://developer.android.com/training/animation/screen-slide.html#pagetransformer
I am using a ViewFlipper to toggle between views. I would like to get the same effect as Facebook's or Youtube's settings views, which is to keep a bit of the last view showing to the right. See image below. How can I do this?
Instead of using a ViewFlipper, try a ViewPager. The ViewPager is best, I think, if you want to have different pages and let the user control which one they see. It uses the paging animation by default, and you can specify page width so the user can see parts of the page next to it.
I am new to android therefore I got a little bit lost with all those ViewFlipper, ViewSwitcher, ViewAnimator and ViewPager. Moreover, I am not sure what's happening under the hood.
Basically I have an activity which shows some data. With swipe (or button, doesnt matter) I would like to scroll the view and get to another page (as seen in the picture below).
Is it possible to implement something like that without changing to another activity?
I am a little bit confused regarding views and access to the design elements. How those pages are located each to another? e.g. If I am currently seeing Page1, can I modify content of Page3? Or plainly saying, are all page views loaded all together? As if I set setContentView(R.layout.xlayout); then I can access only xlayout elements.
But if I use same activity, then I have a thread there which updates a counter on Page1, if I change view to Page 2, the counter will not find Page1 Counter TextView and will complain.
As I Understand Android 4.0 has ViewPager which is similar to the seen in the picture. I am using GB. Should I use support library or can I just go around and implement something similar without importing any libraries?
(Sorry, my description is a little bit messy)
Yes, you can use ViewSwitcher, ViewFlipper and ImageSwitcher depending on your requirements.
ViewSwitcher may have two childs at max. And these child might be a View or an object of subclass of view.
ViewFlipper: May have as many childs you want. and these child might be a View or an object of subclass of view.
ImageSwitcher might be used to switch images over.
By using view flipper you can display one item at a time, and adding a gesture overlay, you can apply sliding effect. To apply View Flipper, you need to add all the views to ViewFlipper, and showNext and showPrevious methods are used to show next and previous child.
You need to use a ViewPager to have the same behaviour as in Google Play.
it only available on recent version of Android, but you can use the Compatibility Package to make it available for older version.
With a ViewFlipper you can't "scroll" between two pages.
I began to study Android not so long ago and have a question relating to which approach I should use to solve the simple task. Let's suppose I have a view (maybe, a button) and I want user to be able to move it across the screen with a finger. Until AbsoluteLayout was deprecated, the right approach seamed obvious. I would've just changed position of my view based on corresponding events. But what is right now?
Create a custom view of your own and add a onTouch event listener. It is very simple. Explained very well here.
If you're trying to move your views in order to navigate through your application or page through images in a gallery, Android provides a collection of widgets to do things like that. If you're trying to, say, pan across a large image, maybe this will help: Image in Canvas with touch events
Im using FrameLayout and update marginLeft and marginTop
You can add multiple children to frame layout, though this is not recommended because of multiple resolutions issues.
from the android docs:
FrameLayout is designed to block out an area on the screen to display
a single item. Generally, FrameLayout should be used to hold a single
child view, because it can be difficult to organize child views in a
way that's scalable to different screen sizes without the children
overlapping each other. You can, however, add multiple children to a
FrameLayout and control their position within the FrameLayout by
assigning gravity to each child, using the android:layout_gravity
attribute.
This "warning" is not applicable in your case because you are explicitly setting the margins according to the user touch event.
I´m writing an application for Android in which I have a character that I must dress with multiple items, such as clothes, hairs, hats, earrings, etc. and on one side of the screen I need to have a container with many items inside that are available for use.
My problem is that I haven´t found any object that lets me do this simple task in android, I need it to be scrollable, and resizeable so I can place it on the right of the screen, the objects i need to add are Imageviews.
I accomplished this on iPhone with a UIScrollView but it seems that it't not that simple with Android.
Thank you.
you will use a ScrollView too, but you need embed a container of your images, like a Layout or Webview inside your ScrollView.