can't set Indicator color programmatically
I want to set indicator color programmatically like if(seekBar.getProgress() == 25{ seekBar.setIndicatorColor("#fffff"); } I found no function name to set color. Please help me.Thanks.
You can custom a indicator and set/change the indicator's view you wanted.like: seekbar.getIndicator().setContentView(your indicatorView, textView( to show progress, must can be found in indicatorView)); then you can change the indicatorView you wanted.
@Aye-Myat-Mon were you able to get it working?
Thank you, I’ve already found solution like you said 😁. indicator.setContentview() really worked well.
@Aye-Myat-Mon @warkiz I also want to change the color of indicator but after reading your comments i can't what to write after indiactor.setContentView Can you explain a little bit more
@Aye-Myat-Mon @warkiz @paul-man can u give me a programming example of changing indicator color?
@Umar431497 @paul-man In my case, I did like this: In java,
final LayoutInflater factory = getLayoutInflater(); final View background = factory.inflate(R.layout.custom_indicator, null); indicatorBg = background.findViewById(R.id.relative); indicatorText = background.findViewById(R.id.isb_progress); seekBar.getIndicator().setContentView(background);
In xml, I added custom background drawable(indicator_blue_bg) in RelativeLayout. `<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/indicator_layout"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/indicator_blue_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:elevation="2dp">
<TextView
android:id="@+id/isb_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:paddingStart="2dp"
android:paddingEnd="1dp"
style="@style/Venus15RegularPrimary"
android:fontFamily="@font/apercu"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</RelativeLayout>` It worked for me. Good luck!!!