Back to project page yammp.
The source code is released under:
GNU Lesser General Public License
If you think the Android project yammp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.yammp.dialog; /* w ww. j a va 2s . co m*/ import org.yammp.view.VerticalTextSpinner; import android.app.AlertDialog; import android.content.Context; import android.util.DisplayMetrics; import android.view.Gravity; import android.widget.LinearLayout; public class VerticalTextSpinnerDialog extends AlertDialog { private VerticalTextSpinner mVerticalTextSpinner; public VerticalTextSpinnerDialog(Context context, String[] items, int position) { super(context); init(context, items, position); } public int getCurrentSelectedPos() { if (mVerticalTextSpinner != null) return mVerticalTextSpinner.getCurrentSelectedPos(); return 0; } private void init(Context context, String[] items, int position) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getResources().getDisplayMetrics(); LinearLayout mContainer = new LinearLayout(context); mContainer.setGravity(Gravity.CENTER); mVerticalTextSpinner = new VerticalTextSpinner(context); mVerticalTextSpinner.setItems(items); mVerticalTextSpinner.setWrapAround(true); mVerticalTextSpinner.setScrollInterval(200); mVerticalTextSpinner.setSelectedPos(position); mContainer .addView(mVerticalTextSpinner, (int) (120 * dm.density), (int) (100 * dm.density)); setView(mContainer); } }