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

IconicsTextView and Html.fromHtml colors #26

Closed
SanderTuit opened this issue Apr 21, 2015 · 4 comments
Closed

IconicsTextView and Html.fromHtml colors #26

SanderTuit opened this issue Apr 21, 2015 · 4 comments
Assignees
Labels

Comments

@SanderTuit
Copy link

IconicsTextView doesn't follow HTML colors when using setText(Html.fromHtml('Test: <font color='#FF0000'>Colored text goes here</font>')). Is this intentional, a bug or a feature? ;-)

@mikepenz
Copy link
Owner

@SanderTuit i assume the spanables which are create by the Html.fromHtml method are overwritten by Android-Iconics. Not sure if it's that easy to keep both.

Is it an required function for you?

@SanderTuit
Copy link
Author

Well, I was actually trying to use it to color the icon, but I guess that would be more difficult altogether. My use case is the following. I'm displaying an icon after a username and want to use different colors for different user types. I guess I can use a different kind of View (perhaps IconicsImageView) if supporting Html.fromHtml is not on your todo list. :-)

@mikepenz
Copy link
Owner

There is something different which allows you to color icons inside a textView :D
Look at the playground activity.

Html.fromHtml is not planned :D

@mikepenz
Copy link
Owner

Here's a snippet how you can style elements of an TextView with spanables :D

//Show how to style the text of an existing TextView
        TextView tv1 = (TextView) findViewById(R.id.test1);
        new Iconics.IconicsBuilder().ctx(this)
                .style(new ForegroundColorSpan(Color.WHITE), new BackgroundColorSpan(Color.BLACK), new RelativeSizeSpan(2f))
                .styleFor("faw-adjust", new BackgroundColorSpan(Color.RED), new ForegroundColorSpan(Color.parseColor("#33000000")), new RelativeSizeSpan(2f))
                .on(tv1)
                .build();

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

No branches or pull requests

2 participants