Coder Social home page Coder Social logo

Comments (7)

magicgoose avatar magicgoose commented on May 18, 2024 1

Here it is: https://gist.github.com/magicgoose/8b4bb1eb7ee428c0fc3b

from android-iconics.

magicgoose avatar magicgoose commented on May 18, 2024

Oops, I found the issue about the same thing #26

BTW, I've found my way — use IconicsDrawable and through some simple maneuvering create a Spanned object consisting of that icon, and then concatenate it with other formatted text as needed.

from android-iconics.

mikepenz avatar mikepenz commented on May 18, 2024

isn't this working for you:

//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();

?

from android-iconics.

magicgoose avatar magicgoose commented on May 18, 2024

If I do it like in your snipped, any existing formatting in tv1's text is lost.

from android-iconics.

mikepenz avatar mikepenz commented on May 18, 2024

@magicgoose ah ok i see. So perhaps this method should be modified to support pre formatted stuff.

from android-iconics.

magicgoose avatar magicgoose commented on May 18, 2024

Or you can include these methods as well https://gist.github.com/magicgoose/8b4bb1eb7ee428c0fc3b, maybe with some overloads which take size as sp or dp, because sometimes it's handy to just get a Spanned text with some icons. (if the text is displayed in something other than a TextView, for example)

from android-iconics.

jemshit avatar jemshit commented on May 18, 2024

@mikepenz Hi, any snippet for using Html.fromHtml with Iconics? I give Spanned to IconicsTextView but it loses formatting.

from android-iconics.

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.