2017-07-26 138 views
0

如標題中所述,某些Android平板電腦不知道有關圖標。我已經在具有相同API級別的不同設備上進行了測試,目前我支持17級,其中一些設備不顯示此圖標。土耳其貨幣圖標(₺)未顯示在某些Android設備上

我可以使用TL代替但我想在可能的情況下顯示圖標。如何檢查設備是否支持此圖標?

回答

1

寫在strings.xml檔案中這樣

<string name="hello">\"</string> 

,並在佈局xml文件中使用的TextView這樣

[![<TextView 
     android:id="@+id/kwh1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/txtdevicename" 
     android:layout_toRightOf="@+id/kwh" 
     android:layout_marginTop="10dp" 
     android:textSize="18sp" 
     android:textStyle="bold" 
     android:layout_marginLeft="10dp" 
     android:text="@string/hello" />][1]][1] 
+0

我什麼都不懂。這是什麼? –

+0

在你的目錄中找到值文件夾和值文件夾strings.xml並寫在那裏 –

1

你可以嘗試使用字體真棒爲土耳其里拉。有些設備可能沒有土耳其里拉代碼,因此您需要採用新的方式。圖示:http://fontawesome.io/icon/try/下載字體後,爲它創建一個自定義的文本視圖(易用)

public class FontAwesome extends TextView { 


    public FontAwesome(Context context, AttributeSet attrs, int defStyle) { 
     super(context, attrs, defStyle); 
     init(); 
    } 

    public FontAwesome(Context context, AttributeSet attrs) { 
     super(context, attrs); 
     init(); 
    } 

    public FontAwesome(Context context) { 
     super(context); 
     init(); 
    } 

    private void init() { 
     Typeface tf = Typeface.createFromAsset(getContext().getAssets(), 
       "/fontawesome.ttf"); 
     setTypeface(tf); 
    } 

} 

中的XML文件,創建你的TextView這樣的:

<your.package.FontAwesomeTextView 
      android:textColor="@android:color/white" 
      android:layout_width="match_parent" 
      android:text="Tutariniz : 30 &#xf195;"<!-- &#xf195; equals Turkish Lira Icon code --> 
      android:layout_height="wrap_content" /> 

你可以按照下面的答案:
How to use Font Awesome icon in android application?