android - Create custom spinner in xml layout -


i want create custom spinner want re-use throughout app. hence, want create spinner xml layout file (i.e. /layout/custom_spinner.xml). have created drawable list

<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android"     android:oneshot="false">     <item android:drawable="@drawable/rocket_thrust1" android:duration="200" />     <item android:drawable="@drawable/rocket_thrust2" android:duration="200" />     <item android:drawable="@drawable/rocket_thrust3" android:duration="200" /> </animation-list> 

now need know how place inside spinner. typical xml spinner looks this

<progressbar     android:id="@+id/spinner"     style="?android:attr/progressbarstylelarge"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"     android:layout_centervertical="true"     android:visibility="invisible" /> 

how accomplish want?

edit:

the following works, shows 4 progress spinners/bars instead of 1 in center.

 <progressbar     android:id="@+id/spinner"     android:layout_width="match_parent"     android:layout_height="100dp"     android:layout_centerinparent="true"     android:indeterminate="true"     android:indeterminatedrawable="@drawable/my_icon"     android:visibility="visible" /> 

the term spinner in android refers other progressbar.

however, @ setprogressdrawable(drawable d) , setindeterminatedrawable(drawable d) methods.

you need remove line

style="?android:attr/progressbarstylelarge"

edit:

<rotate android:drawable="@drawable/my_icon" android:pivotx="50%" android:pivoty="50%" android:fromdegrees="0" android:todegrees="360" /> 

i can't find specific rotate drawable info in docs unsure needs wrapped in, if anything.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -