2017-07-26 137 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?