Custom spinner dialog for Android
How do I do a custom the开发者_开发技巧me android spinner dialog?
This blog has an example that probably covers your question:
http://www.mokasocial.com/2011/03/easily-create-a-default-custom-styled-spinner-android/
Edit:
These blog posts has a pretty similar answer: http://karanbalkar.com/2013/07/tutorial-39-create-custom-spinner-in-android/ http://stephenpengilley.blogspot.no/2013/01/android-custom-spinner-tutorial.html
The key to customizing an Android Spinner is to create a custom resource for the spinner rows, and then passing that row layout into a custom adapter. In the custom adapter, one can override the following two functions:
@Override
public View getDropDownView(int position, View cnvtView, ViewGroup prnt) {
// Custom view generation
}
@Override
public View getView(int pos, View cnvtView, ViewGroup prnt) {
// Custom view generation
}
To determine how the Android Spinner will look to the user.
精彩评论