2017-10-05 11 views
-7

私はアンドロイドの初心者です。私はアイコンのためのフォント素晴らしいライブラリを使用しています。私はfontawesomeを使ってtablayoutアイコンを設定する方法

<?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レイアウトを作成し、ビューページャ

+2

コードを投稿できますか? –

答えて

1

を使用してフォント、素晴らしいtablyoutで使用してアイコンを設定したいです

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

本当にありがとうございました。 –

関連する問題