TypeFaceTextView.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:android-permission-checker-app 作者:
private void init(AttributeSet attrs) {
  if (attrs != null) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TypeFaceTextView);
    String fontName = a.getString(R.styleable.TypeFaceTextView_fontName);
    if (fontName != null) {
      Typeface myTypeface = inflatedFonts.get(fontName);
      if (myTypeface == null) {
        myTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/" + fontName);
        inflatedFonts.put(fontName, myTypeface);
      }
      setTypeface(myTypeface);
    }
    a.recycle();
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号