Encountered a problem description:
Spinner style of use, the system comes with is not generally ugly, and the style you designed completely out of sync, but for spinner by changing the background
The way the picture makes it look more beautiful, more in line with our aesthetic design. The problem I encountered was that for item and spinner are designed for the same background picture, if different, when selecting
After item, the value of item will be overwritten with the image in spinner, so that spinner does not get the expected display, but it is not appropriate to have the same background image in spinner and item. The problem is
Make the item in spinner and spinner have a different background picture?
See a drop-down effect that appears when you click Spinner
The item in spinner is dynamically added by Setadapter, and the API itself has a spinneradapter, and it's good to rewrite Getdropdownview!
1, spinner by two layout view from the definition, respectively, is responsible for displaying the spinner (part) and click on the display of the item (two part) of a layout situation
2, rewrite adapter method (online A lot of arrayadapter, but all refer to the Android.r.layout.simple_spinner_item.xml system comes with), is generally inherited baseadapter rewrite GetView () and Getdropdownview this
Two methods. GetView modifies the style shown in spinner (that is, layout of layouts), Getdropdownview determines the style displayed in item.
It is not difficult to recognize the two-point definition of a custom spinner.
The practice of this:
1, define the spinner, set the background for the picture with the triangle as the background color.
2, for GetView and Getdropdownview in the same code (just two of the use of layout is not the same), layout of different points is only the background color is different (GetView layout no background image, Getdropdownview set a gray background image)
This paper mainly solves the problem of spinner custom style, and has a deeper understanding of spinner. Each person encounters a different problem, the solution is not unique, for reference only.
Welcome to shoot Bricks!
Make spinner and spinner have different background images-------custom spinner to design the spinner! you want