Spinner OrginalSpinner = (Spinner) findViewById(R.id.SpinnerOrginal) īutton_UseSelectedItem = (Button) findViewById(R.id.buttonUseItem) MySpinner = (Spinner) findViewById(R.id.SpinnerCustom) Public class SpinnerTest extends ActivityĪrrayList void onCreate(Bundle savedInstanceState) Public CountryInfo(String cName, long cPopulation, int flagImage)Īnd lastly our main activity with our CountryAdapter class that will implement the view. Private int countryFlag // Populate it with our resource ID for the correct image. Next up our helper class from the previous entry with a little modification. Okay, the images done! Just need to change the spinner background to to get our own look! I still use the android.R.layout.simple_spinner_item to display the objects in my spinner. ![]() There's 5 different states that can be used but i just made images for two. They should be located in ~androidsdkroot/platforms/android-(yourversion)/data/res/drawable-hdpi. Next, i just reworked the btn_dropdown_* images that ships with the Android SDK. Using style= tag on the spinner didnt work for me to override the styles, so i just changed the background.įirst a custom drawable selector with the appropiate images. ![]() Lets spin forward by implementing a custom spinner with a custom drop down view!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |