大佬教程收集整理的这篇文章主要介绍了Android:Crouton lib和自定义字体,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<?xml version="1.0" encoding="utf-8"?> <com.ecab.ui.custom.TextViewCustomFont xmlns:android="http://scheR_530_11845@as.android.com/apk/res/android" xmlns:custom="http://scheR_530_11845@as.android.com/apk/res/com.crouton" android:id="@+id/crouton" android:layout_width="match_parent" android:layout_height="wrap_content" android:BACkground="@drawable/ban_confirmation" android:gravity="center" android:text="TEST" android:textColor="@android:color/white" custom:typeface="gothamBold" />
在Style类中:
INFOCUSTOM = new Builder().setDuration(3000).setTextAppearance(R.id.crouton).build();
然后,我试图通过使用我的字体更改setTypeface()来实现它,它不起作用.
在Crouton班:
private TextView initializeTextView(final resources resources) { TextView text = new TextView(this.activity); text.setId(TEXT_ID); text.setText(this.text); text.setTypeface(MyFonts.getGothamBookBold(this.activity)); Log.d(Constants.D_TAG,"chaneg the typeFace"); text.setGravity(this.style.gravity); // set the text color if set if (this.style.textColorresourcEID != 0) { text.setTextColor(resources.getColor(this.style.textColorresourcEID)); } // Set the text size. If the user has set a text size and text // appearance,the text size in the text appearance // will override this. if (this.style.textSize != 0) { text.setTextSize(TypedValue.COMPLEX_UNIT_SP,this.style.textSizE); } // Setup the shadow if requested if (this.style.textShadowColorResId != 0) { initializeTextViewShadow(resources,text); } // Set the text appearance if (this.style.textAppearanceResId != 0) { text.setTextAppearance(this.activity,this.style.textAppearanceResId); } return text; }
如何拥有自定义字体?
ps:库版本==> 1.7
以上是大佬教程为你收集整理的Android:Crouton lib和自定义字体全部内容,希望文章能够帮你解决Android:Crouton lib和自定义字体所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。