美文网首页Android开发Android开发经验谈Android技术知识
Android 三色状态指示进度条 - ThreeColorIn

Android 三色状态指示进度条 - ThreeColorIn

作者: 爱因私谈 | 来源:发表于2019-09-29 17:01 被阅读0次

ThreeColorIndicator

Sample 下载
Github 项目地址

这是一个 Android 三色状态指示进度条,常用于指示:信号强度、温度等,可通过文字、颜色表示一个值的好、一般、差,也可以自定义为其它状态。

预览图

使用

Gradle ​

修改项目 build.gradle,增加如下代码:

    dependencies {
        compile 'com.ayst.tci:threecolorindicator:1.0.3'
    }

Java

    public class MainActivity extends AppCompatActivity {
    
        private ThreeColorIndicator mThreeColorIndicator;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            mThreeColorIndicator = (ThreeColorIndicator) findViewById(R.id.indicator);
            mThreeColorIndicator.setValue(80);
        }
    }

XML

   <com.ayst.view.ThreeColorIndicator
       android:id="@+id/indicator"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       app:tci_min="0"
       app:tci_max="100"
       app:tci_firstColor="@color/red"
       app:tci_secondColor="@color/yellow"
       app:tci_thirdColor="@color/green"
       app:tci_progressHeight="20dp"
       app:tci_progressRadius="0px"
       app:tci_firstRange="30"
       app:tci_secondRange="20"
       app:tci_value="80"
       app:tci_firstText="Poor"
       app:tci_secondText="Fair"
       app:tci_thirdText="Good"
       app:tci_indicatorText="-20dBm"
       app:tci_indicatorTextColor="@android:color/white"
       app:tci_indicatorTextSize="12sp"
       app:tci_indicatorTextWidth="50dp"
       app:tci_indicatorTextHeight="12sp"
       app:tci_indicatorDrawable="@mipmap/ic_three_color_indicator"
       />

NOTE:

  • tci_firstColor - First range color
  • tci_secondColor - Second range color
  • tci_thirdColor - Third range color
  • tci_max - Max value
  • tci_min - Min value
  • tci_value - Value
  • tci_progressHeight - Progress bar height
  • tci_progressRadius - Progress radius
  • tci_firstRange - This is a percentage, starting with the minimum value, showing first color within this percentage
  • tci_secondRange - This is a percentage, starting with the first range, showing second color within this percentage
  • tci_firstText - First Range indicator text
  • tci_secondText - Second Range indicator text
  • tci_thirdText - Third Range indicator text
  • tci_indicatorText - Indicator text
  • tci_indicatorTextColor - Indicator text color
  • tci_indicatorTextSize - Indicator text size
  • tci_indicatorTextWidth - Indicator text width
  • tci_indicatorTextHeight - Indicator text height
  • tci_indicatorDrawable - Indicator icon id

相关文章

  • Android 三色状态指示进度条 - ThreeColorIn

    ThreeColorIndicator Sample 下载Github 项目地址 这是一个 Android 三色状...

  • 控件 - ProgressBar

    ProgressBar 进度条 进度条 属性 android:id:ID,唯一标识符。 android:layou...

  • IOS UIProgressView,UISwitch

    UIProgressView进度条 //进度条,高度固定(2) ,为普通的视图控件,一般用于指示下载进度 //进度...

  • ProgressBar进度条

    SeekBar :搜寻进度条RatingBar:评价进度条 style="?android:attr/progre...

  • Android进度条

    Android进度条 不同的进度条显示结果: demo xml代码: 二.模拟进度条加载过程:运行展示图: xml...

  • Android之进度条控件和常用资源分类总结

    1 基本UI(二) 1.1进度条 1.1.1 【 常用属性: style进度条样式 Android:max进度...

  • SeekBar

    Android-SeekBar进度条的使用Android控件与布局——基础控件SeekBar

  • 自定义进度条

    1.自定义进度条UI 2.进度条动效 Animate ProgressBar update in Android

  • 进度条使用

    目录 ProgressBar(进度条) ProgressBar是Android下的进度条,也是为数不多的直接继承于...

  • radialIndicator.js的使用

    radialIndicator是一个简单轻巧的圆形指示器/进度条的插件插件的上手比较容易,这里记录下在指示器内有图...

网友评论

    本文标题:Android 三色状态指示进度条 - ThreeColorIn

    本文链接:https://www.haomeiwen.com/subject/detqpctx.html