Giter VIP home page Giter VIP logo

Comments (9)

odemolliens avatar odemolliens commented on July 30, 2024 3

Other try with Spannable in PixlUI sample:

TextView mBox = (TextView) findViewById(R.id.textView1); Spannable word = new SpannableString("Your message"); word.setSpan(new ForegroundColorSpan(Color.BLUE), 0, word.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mBox.setText(word); Spannable word1 = new SpannableString("Your new message"); word1.setSpan(new ForegroundColorSpan(Color.RED), 0, word1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mBox.append(word1);

And it's showing this:

untitled2

from pixlui.

odemolliens avatar odemolliens commented on July 30, 2024

Do you use Spannable ? Html.fromHtml?

from pixlui.

edriang avatar edriang commented on July 30, 2024

I've tested both of them and neither has worked for me.

Using spanable or html worked for me only with android default textview (same come, same example)

---- Mensaje original ---

De: "@odemolliens" [email protected]
Enviado: 7 de mayo de 2014 5:57 a.m.
Para: "neopixl/PixlUI" [email protected]
Cc: "edriang" [email protected]
Asunto: Re: [PixlUI] Single TextView with two or more colors (#9)

Do you use Spannable ? Html.fromHtml?


Reply to this email directly or view it on GitHub:
#9 (comment)

from pixlui.

odemolliens avatar odemolliens commented on July 30, 2024

I have try this in the PixlUI in the sample

TextView mBox = (TextView) findViewById(R.id.textView1);

mBox.setText(Html.fromHtml("<b>" + "lol" + "</b>" + "<br />" + "<small><font color=\"red\">" + "test" + "</font></small>" + "<br />" + "<small><font color=\"blue\">" + "test" + "</small></font>"));

And it's showing this:

untitled

So where is the problem?

from pixlui.

odemolliens avatar odemolliens commented on July 30, 2024

On one line (with Html.fromHtml)
untitled

from pixlui.

odemolliens avatar odemolliens commented on July 30, 2024

I close if I got no news. It's seems working !!!

from pixlui.

edriang avatar edriang commented on July 30, 2024

Hi, I'm applying style in this way and doesn't work with pixl's TextView, but works OK setting the font manually in TextView from code:

//String pad = "000";
//String score = "23";

Spannable padString = new SpannableString(pad);
padString.setSpan(new ForegroundColorSpan(0x80FFFFFF), 0, pad.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

Spannable scoreString = new SpannableString(score);
scoreString.setSpan(new ForegroundColorSpan(0xFFFFFFFF), 0, score.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

textView.setText(padString);
textView.append(scoreString);

from pixlui.

edriang avatar edriang commented on July 30, 2024

I'm using the .jar 1.0.5 downloaded from here: https://github.com/neopixl/PixlUI/releases

from pixlui.

buffpojken avatar buffpojken commented on July 30, 2024

I just ran into this as well - doesn't work with Pixlui - either Html.fromHtml or Spannable. Changing to regular android.widget.TextView makes it work as expected.

from pixlui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.