2017-10-05 99 views

回答

1

使用字体真棒在tablyout图标创建

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/tab" 
    /> 

标签布局现在设置字体使用下面的代码custom_tab.xml

custom_tab.xml命名的XML布局

TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null); 
tabOne.setText("&#xf1fe;"); 
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf"); 
tabOne.setTypeface(typeface); 
tabLayout.getTabAt(0).setCustomView(tabOne); 

How to Use FontAwesome in an Android App

+1

真的很感谢它的工作正常。 –

相关问题