Custom spinner dialog for Android

2019-05-05 14:17发布

How do I do a custom theme android spinner dialog?

1条回答
手持菜刀,她持情操
2楼-- · 2019-05-05 14:55

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.

查看更多
登录 后发表回答