Giter VIP home page Giter VIP logo

simplifyspan's Introduction

Android Gems Android Arsenal @iwgang

SimplifySpan

A easy-to-use and powerful Spannable library

screenshot


gradle

compile 'com.github.iwgang:simplifyspan:2.0'

Support Units

  • SpecialTextUnit
    • text (Constructor | String)
    • gravity (setGravity(gravity | int)) SpecialGravity.TOP, SpecialGravity.CENTER, SpecialGravity.BOTTOM
    • convertMode (setConvertMode(convertMode | int)) SpecialConvertMode.ONLY_FIRST, SpecialConvertMode.ALL, SpecialConvertMode.ONLY_LAST
    • textColor (Constructor Or setTextColor(int color))
    • textSize (Constructor Or setTextSize(float size)) ps
    • textBackgroundColor (setTextBackgroundColor(int color))
    • isShowUnderline (showUnderline())
    • isShowStrikeThrough (showStrikeThrough())
    • isTextBold (useTextBold())
    • clickableUnit (setClickableUnit(SpecialClickableUnit))
  • SpecialLabelUnit
    • text (Constructor | String)
    • gravity (setGravity(gravity | int)) SpecialGravity.TOP, SpecialGravity.CENTER, SpecialGravity.BOTTOM
    • convertMode (setConvertMode(convertMode | int)) SpecialConvertMode.ONLY_FIRST, SpecialConvertMode.ALL, SpecialConvertMode.ONLY_LAST
    • labelTextColor (Constructor | int color)
    • labelTextSize (Constructor | int color) sp
    • labelBgColor (Constructor | int color)
    • bitmap (Constructor | Bitmap)
    • labelBgRadius (setLabelBgRadius(float radius)) Only support labelBgColor
    • labelBgWidth And labelBgHeight (Constructor Or setLabelBgSize(int width, int height)) px
    • padding (setPadding(int padding)) px
    • paddingLeft (setPaddingLeft(int padding)) px
    • paddingRight (setPaddingRight(int padding)) px
    • labelBgBorderColor And borderSize (showBorder(int labelBgBorderColor, float borderSize | px))
    • isTextBold (useTextBold())
    • clickable See SimplifySpanBuild.appendMultiClickable() Or SimplifySpanBuild.appendMultiClickableToFirst()
  • SpecialImageUnit
    • text (Constructor | String)
    • gravity (setGravity(gravity | int)) SpecialGravity.TOP, SpecialGravity.CENTER, SpecialGravity.BOTTOM
    • convertMode (setConvertMode(convertMode | int)) SpecialConvertMode.ONLY_FIRST, SpecialConvertMode.ALL, SpecialConvertMode.ONLY_LAST
    • bitmap (Constructor)
    • width And height (Constructor) px
    • clickable See SimplifySpanBuild.appendMultiClickable() Or SimplifySpanBuild.appendMultiClickableToFirst()
  • SpecialClickableUnit
    • curTextView (Constructor | TextView)
    • onClickListener (Constructor | OnClickableSpanListener)
    • isShowUnderline (showUnderline())
    • pressTextColor (setPressTextColor(int color))
    • pressBgColor (setPressBgColor(int color))
    • normalTextColor (setNormalTextColor(int color))
    • normalBgColor (setNormalBgColor(int color))
  • SpecialRawSpanUnit
    • text (Constructor | String)
    • spanObj (Constructor) Spannable Object
    • flags (Constructor | int) Spannable flags

Support Methods

  • SimplifySpanBuild
    • append (string | Units)
    • appendToFirst (string | Units)
    • appendMultiClickable ()
    • appendMultiClickableToFirst ()
    • build ()

how to use ?

Sample Code

// sample 1
tvText.setText(new SimplifySpanBuild("距离您:").append(new SpecialTextUnit("385", Color.BLUE)).append(" 米").build());

// sample 2
CharSequence spannableString = new SimplifySpanBuild(" 艾客优品雷霆Dock 2 雷电转USB3.0/火线/esata 扩展HUB")
        .appendToFirst(new SpecialLabelUnit("1212", Color.WHITE, sp2px(8), Color.RED, 70, 35).useTextBold().setGravity(SpecialGravity.CENTER))
        .appendToFirst(new SpecialLabelUnit("天猫", Color.WHITE, sp2px(8), 0xFFFF5000, 60, 35).setGravity(SpecialGravity.CENTER))
        .build();
tvText.setText(spannableString);

simplifyspan's People

Contributors

iwgang avatar

Watchers

James Cloos avatar ocean_yang avatar

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.