Need to implement a View which contains 5 Images placed in stack order. When user move finger up or down at this View picture replace each other.
This approach looks like StackView in Android 3.0, but standard StackView displays applications and it works from API 11 level and I develop for Eclair.
Would like to know if you know some sources where this kind of view has already implemented for Android 2.X, or may be you'll give me an advice to try another one approach to implement this stylization kind.
One option may be to pull the StackView source from a recent Android source base and place it in your application. If I were to do this I would certainly change the package name, and in order to maintain forward compatibility I would see if the original class exists on the platform and use that instead.
If I were to implement what you describe without consideration for having StackView, I would think this could be done easily enough by overriding ImageView and giving my class an array of images to have the source cycle through.
Related
When using the layout designer in Android Studio, custom classes that I create which extend the View class show up in the layout designer (picture relevant)
Is there a similar way to make custom classes appear that extend the Fragment class?
My use case is that I'm developing a library which I will distribute to our clients. I want it to be as easy as possible for someone to use this library to place a video player in their own application. I discovered that fragments may be exactly what I need -- something which has a defined appearance, can be trivially dropped into someone else's layout, yet is able to manage its own state, perform business logic, and listen to life cycle events (for the sake of cleaning up video buffers, stopping timers, and de-allocating resources)
However when I tried switching from using a View to using a Fragment, it didn't show up in the palette to be dragged and dropped into my app. While not absolutely and incredibly super-duper necessary, I was really hopeful that I could maintain that as an ease-of-use feature.
What I mean to say while you're just getting started with the development and say you add a slider theres a predefined skin for that and you can place it somewhere on the screen, but in some apps there are things like a knob in a place of slider which you can rotate to do the same stuff what the slider does . How do they do that, does it require openGL or something I am not asking for a complete tutorial or something just curious on what stuff goes into building such thing
Mostly, if something is not provided out of the box, you will have to build your own control.
For example, you mention a Knob. That isn't available in the Android SDK. Such a control could prove to be useful.
Here is a tutorial to build such a custom Control: http://go-lambda.blogspot.in/2012/02/rotary-knob-widget-on-android.html
This is an image of the final result from the tutorial linked above:
Here is an example of a custom slider / seek bar: http://permadi.com/blog/2011/11/android-sdk-custom-slider-bar-seekbar/
This should give you a rough idea on how to go about creating your own custom views.
And finally, what I personally find the best possible resource for keeping track of almost all good Custom Views is here: http://www.androidviews.net/
The androidviews.net website has shut down. Android Arsenal is a new website that lists several third party Android libraries.
I am trying to develop custom launcher app (with unlimited number of home pages)and i need to implement Drag and Drop as done in Launcher2(android 4.2).
So i found two approaches
1) Drag and Drop framework
2) Use the android launcher2 way like implementation DragController, DragSource as explained here.
But i am struggling to understand why didn't Android guys didn't use the Drag and Drop framework developed by them in their own application. Can anyone brief regarding possible rationale behind their approach?( i mean in terms of memory/performance)
Thanks in advance.
The Android drag and drop framework is very basic as compared to the one used in the Launcher app.
The Launcher app has a myriad of "layers" and the drag and drop occurs accross these layers, namely the DragLayer, Workspace and the All Apps view etc. It uses window flags and dynamically adds/removes views to the DragLayer when a drag is in progress and a multitude of activities monitor the drag. For more details look at the DragLayer.java and Workspace.java files particularly.
Drag and Drop in Android Launcher is done as Overlay drawing within the same ViewGroup and in same window . But android drag and drop approach creates a separate window with a separate window type altogether .
Resource and memory wise standard android drag and drop approach is costlier.
If performance is very critical my suggestion is go as per Android launcher way else prefer standard android approach its easy and simple.
Drag and Drop framework is sice api 11.
My guess is, lot of code for launcher was written before that, and noone had time to refactor it yet. But api works similar like second approach.
http://javapapers.com/android/android-drag-and-drop/. This is the best drag and drop example since i have implemented the same in my application. Note: It will support versions only above 11. The drag and drop feature will not support for version 10. Instead u have to move the fields in a absolute layout by settin X and Y positons. But Absolute layout is completely deprecated...
You should use WindowManaager to control Drag And Drop if in case your Application is not so much complex. This is easy to implement and work on Position changed. get the code Here
I want to show a dashboard like interface in my Android tablet app where the user can drag and drop listviews using touch. Is there a library that i can use to give d&d to my app?
For android 3.0 and up, which is usually in all Android tablets. You can use this:
http://developer.android.com/guide/topics/ui/drag-drop.html
You do not necessarily need a library to give the drag and drop functionality. It is already in Android 3.0 and up. If you want the code, the best way is to write it yourself as it will suit you to what you want. To learn about it, look at several examples and read them. It is pretty simple and acts much like OnTouchListener and MotionEvent.
I'm writing playing cards game. I have implemented dragging and dropping one view onto another based on this tutorial.
Now I want to animate opponent moves.
Is there easy way to to this?
I thought about using TouchUtils.dragViewBy(...), but it isn't supported on device.
for opponents move, shouldn't you use animations instead?
for this, you could use either the old API or the new one, or use a compatibility library instead .
do note that if you run animations on old android versions (even with the compatibility library) meaning API 10 and below, the view only looks to be on the position that you see it, but actually it stayed on the original position.