Rating Bar
How to add?
I. In yourbuild.gradle add latest appcompat library.II. Make your activity extenddependencies { compile
compile 'com.android.support:appcompat-v7:X.X.X' // where X.X.X version}
android.support.v7.app.AppCompatActivity.III. Declare yourpublic class MainActivity extends AppCompatActivity {...}
RatingBar inside any layout.xml file.<RatingBarandroid:rating="3.5"android:stepSize="0.5"android:numStars="5"android:layout_width="wrap_content"android:layout_height="wrap_content"/>
How to style?
I. Declare custom style in your
styles.xml file.II. Apply this style to your<style name="RatingBar" parent="Theme.AppCompat"><item name="colorControlNormal">@color/indigo</item><item name="colorControlActivated">@color/pink</item></style>
RatingBar via android:theme attribute.<RatingBarandroid:theme="@style/RatingBar"android:rating="3"android:stepSize="0.5"android:numStars="5"android:layout_width="wrap_content"android:layout_height="wrap_content"/>


No comments:
Post a Comment