I am developing an app in which I need to change the spinner background layout to match the background color. I researched and found that I need to create a 9 patch image. I have done creating the 9 patch image and used in the app but it looks bigger than the normal spinner and also I couldn't see the drop down button in the spinner as well.
I am so happy if you guys provide me a clear tutorial from start creating the 9 patch image for Spinner and using it in the app.
Code for the Spinner
<Spinner android:id="@+id/spnIncredientone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/txtMixtureTitle" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" android:background="@drawable/spinner_background" android:prompt="@string/selectmixture" />
Spinner is a widget that is used to select an item from a list of items. When the user tap on a spinner a drop-down menu is visible to the user. In this article, we will learn how to add custom spinner in the app.
Android Spinner is a view similar to the dropdown list which is used to select one option from the list of options. It provides an easy way to select one item from the list of items and it shows a dropdown list of all values when we click on it.
You can set the spinners background color in xml like this:
android:background="YOUR_HEX_COLOR_CODE"
and if you use the drop down menu with you spinner you can set its background color like this:
android:popupBackground="YOUR_HEX_COLOR_CODE"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With