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

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

   

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 三色状态指示进度条 - ThreeColorIndicator)