Hello guys
Today we are learn how to set image in spinner
So you create a resource xml and paste below code ..
tringle.xml
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <layer-list> <item> <shape> <stroke android:width="1dp" android:color="#c4c7d0" /> <solid android:color="@color/primary_color"/> <padding android:left="5dp" android:right="5dp"/> </shape> </item> <item android:top="5dp" android:right="5dp" android:bottom="5dp"> <bitmap android:src="@drawable/spinner_triangle" android:gravity="center_vertical|right"/> </item> </layer-list> </item> </selector>and now you create spinner and write some code ....like setBackgroundmainactivity.xml
<Spinner
android:id="@+id/toolbar_spinner"android:background="@drawable/spinner_tringle"android:spinnerMode="dropdown"android:layout_alignParentRight="true"android:layout_width="wrap_content"android:popupBackground="#990000"android:layout_height="wrap_content"/>Thank youI hope help this blog
No comments:
Post a Comment