我正在使用android自定义字体lib书法https://github.com/chrisjenx/Calligraphy。
但是对textview没有影响。我正在使用以下代码:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(new CalligraphyContextWrapper(newBase)); } }
在XML中:
在attrs中:
在Assets / font / gotham-book.ttf中
从中删除名称空间TextView
。
<TextView tools:context="" android:layout_ android:layout_ android:text="Touch Listner" android:textSize="18sp" fontPath="fonts/gotham-book.ttf" />
(更改app:fontPath
为fontPath
)
令人讨厌的是,我们无法解析auto-res命名空间。