android 动画 三色流动,Android 三色状态指示进度条 - ThreeColorIndicator

ThreeColorIndicator

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

预览图

57356a3c9749

使用

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值