zoukankan      html  css  js  c++  java
  • RatingBar 自定义style的用法

    第一步:配置ratingbar 的style

    <style name="foodRatingBar" parent="@android:style/Widget.RatingBar">
      <item name="android:progressDrawable">@drawable/food_ratingbar_full</item>
      <item name="android:minHeight">48dip</item>
        <item name="android:maxHeight">48dip</item>
    </style>

    第二部:配置 drawable

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:id="@+android:id/background"
              android:drawable="@drawable/fans_mark_gray" />
        <item android:id="@+android:id/secondaryProgress"
              android:drawable="@drawable/fans_mark_gray" />
        <item android:id="@+android:id/progress"
              android:drawable="@drawable/fans_mark_red" />
    </layer-list>

    第三部:引用 style

    <RatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"       
            android:numStars="5"//star 数量
            android:stepSize="1" //如果可以交互 每次的增量
            android:isIndicator="false"//true 不可交互
            android:rating="2"                 //默认 进度2
           style="@style/foodRatingBar"       
             />

  • 相关阅读:
    SilkTest Q&A 5
    SilkTest Q&A 6
    产生n不同随机数的算法
    根据日期计算星期小算法
    Linux $( )与${ }的区别
    UVA 10313(完全背包变形)
    HDU 4277 USACO ORZ
    Android Studio上手,基于VideoView的本地文件及流媒体播放器
    Mina框架项目运用
    【iOS】怎样推断文本文件的字符编码格式
  • 原文地址:https://www.cnblogs.com/lipeil/p/2590457.html
Copyright © 2011-2022 走看看