Font Awesome Text 使用方法
阅读原文时间:2023年07月08日阅读:2


fontawesometext:fa_icon="fa-github" the icon to place, as per the Font Awesome Cheat Sheet

android:textSize="12sp" Text size must always be in sp!

android:textColor="@color/bbutton_primary" you can change the textColor or background to any color, including the Bootstrap colours by typing bbutton_ and the type of colour e.g. bbutton_danger for the red danger colour.

NEW

fontAwesomeText.setIcon("fa-heart"); change the icon programmatically

Animations

//get access to some FontAwesomeText items in the layout
FontAwesomeText tv1 = (FontAwesomeText) findViewById(R.id.lblOne);
FontAwesomeText tv2 = (FontAwesomeText) findViewById(R.id.lblTwo);
FontAwesomeText tv3 = (FontAwesomeText) findViewById(R.id.lblThree);

//flashing forever FAST
tv1.startFlashing(this, true, FontAwesomeText.AnimationSpeed.FAST);

//rotating clockwise slowly
tv2.startRotate(this, true, FontAwesomeText.AnimationSpeed.SLOW);

//rotating anti-clockwise at medium speed
tv3.startRotate(this, false, FontAwesomeText.AnimationSpeed.MEDIUM);

startFlashing(Context context, boolean forever, AnimationSpeed speed);

@param context the current applications context

@param forever whether the item should flash repeatedly or just once

@param speed how fast the item should flash, chose between FontAwesomeText.AnimationSpeed.SLOW / FontAwesomeText.AnimationSpeed.MEDIUM / FontAwesomeText.AnimationSpeed.FAST

startRotate(Context context, boolean clockwise, AnimationSpeed speed);

@param context the current applications context

@param clockwise true for clockwise, false for anti clockwise spinning

@param speed how fast the item should flash, chose between FontAwesomeText.AnimationSpeed.SLOW / FontAwesomeText.AnimationSpeed.MEDIUM / FontAwesomeText.AnimationSpeed.FAST

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章