Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't set Indicator color programmatically #144

Open
Aye-Myat-Mon opened this issue Jan 12, 2019 · 6 comments
Open

can't set Indicator color programmatically #144

Aye-Myat-Mon opened this issue Jan 12, 2019 · 6 comments

Comments

@Aye-Myat-Mon
Copy link

Aye-Myat-Mon commented Jan 12, 2019

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.

@warkiz
Copy link
Owner

warkiz commented Jan 22, 2019

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.

@paul-man
Copy link

paul-man commented Jun 1, 2019

@Aye-Myat-Mon were you able to get it working?

@Aye-Myat-Mon
Copy link
Author

Thank you, I’ve already found solution like you said 😁.
indicator.setContentview() really worked well.

@Umar431497
Copy link

@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

@Umar431497
Copy link

@Aye-Myat-Mon @warkiz @paul-man can u give me a programming example of changing indicator color?

@Aye-Myat-Mon
Copy link
Author

Aye-Myat-Mon commented Jan 7, 2020

@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
    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>

`
It worked for me. Good luck!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants