In my application I want to create a dropDown that shows data, but the dropDown looks like a dropDown as shown in web not like a spinner.
Asked
Active
Viewed 7,913 times
2
-
possible duplicate of http://stackoverflow.com/questions/3451889/android-popup-menu – Ganesh K Jul 12 '12 at 09:43
-
If you are working with API Level 11 or above http://developer.android.com/reference/android/widget/PopupMenu.html – Ganesh K Jul 12 '12 at 09:45
2 Answers
4
I have created a dropdown demo project on github to help out with this I'm my mind missing view/widget.
Its based on a text view (title) used to display the currently selected alternative, and a linear layout containing the alternative. When the title is clicked i animate in the linear layout with the alternatives, and once a alt is selected the linear layout is animated out.
The project can be found here:
https://github.com/erbsman/DropDownDemo
hope this helps :)

Carl-Emil Kjellstrand
- 1,233
- 1
- 10
- 17
-
http://www.youtube.com/watch?v=JX9RmLAoOUY for a video of how it looks, to help you decide if this is what you want :) – Carl-Emil Kjellstrand Nov 11 '12 at 15:28
0
You can create an animation class like this
public class DropDownAnimation extends Animation {
public int height, width;
@Override
public void initialize(int width, int height, int parentWidth,
int parentHeight) {
// TODO Auto-generated method stub
super.initialize(width, height, parentWidth, parentHeight);
this.width = width;
this.height = height;
setDuration(500);
setFillAfter(true);
setInterpolator(new LinearInterpolator());
}
Camera camera = new Camera();
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
// TODO Auto-generated method stub
super.applyTransformation(interpolatedTime, t);
Matrix matrix = t.getMatrix();
camera.save();
camera.getMatrix(matrix);
matrix.setTranslate(0, (height * interpolatedTime));
matrix.preTranslate(0, -height);
camera.restore();
this.setAnimationListener(this);
}
and use it like this :
LinearLayout ll = (LinearLayout) findViewById(R.id.parentLayout);
ll.startAnimation(new DropDownAnimation());

Vinay W
- 9,912
- 8
- 41
- 47