2017-10-05 101 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

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

相關問題