Android : Android changing color of Progress bar inner circle

on Sunday, August 31, 2014


I have a progress bar and a textview


My progressbar.xml looks like



<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="7.0">
<gradient
android:centerColor="#007DD6"
android:endColor="#FF000F"
android:startColor="#007DD6"
android:angle="90"
android:type="sweep"
android:useLevel="false" />
</shape>


My layout is:



<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="60dp"
android:layout_height="60dp"
android:indeterminate="false"
android:max="60"
android:progressDrawable="@drawable/progressbar">
</ProgressBar>
<TextView
android:id="@+id/progresstext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/transparent"
android:gravity="center" />
</RelativeLayout>

one more frame layout after this


I have a countdown of 60 seconds and i show that in progresstext. What i want to do is whenever the count down reaches 45 seconds, i want to change the color of inner circle to red(or any color for that matter) to indicate the user about the time.


I have tried changing the background color of textview but it did not cover the whole inner circle. Is there any way to change the color of the inner circle???


Thank you :)


0 comments:

Post a Comment