How do I do a custom theme android spinner dialog?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.