繁体   English   中英

android TextView不显示希伯来字体

[英]android TextView doesn't show hebrew fonts

我正在尝试在m TextView中显示希伯来语文本。

我在这里读过我需要将字体从默认的android更改为支持希伯来语的字体。

我尝试了几种解决方案,但没有一个可行:

    Typeface font= Typeface.createFromAsset(mContext.getAssets(), "fonts/Raanana.ttf");
    titleTextView.setTypeface(font); 

    titleTextView.setText(mTitles[position]);

要么:

    titleTextView.setText(Html.fromHtml(mTitles[position]));

这是我的xml:

<ImageView
    android:id="@+id/todo_row_image"
    android:layout_width="50dp"
    android:layout_height="30dp"
    android:layout_marginBottom="32dp"
    android:layout_marginLeft="21dp"
    android:contentDescription="my image" />

<TextView
    android:id="@+id/todo_row_title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="6dp"
    android:lines="1"
    android:text="@+id/titleTextView"
    android:layout_toRightOf="@id/todo_row_image"
    android:textSize="12sp" >
</TextView>

<TextView
    android:id="@+id/todo_row_date"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/todo_row_title"
    android:layout_marginTop="6dp"
    android:lines="1"
    android:text="@+id/dateTextView"
    android:textSize="12sp" >

</TextView>

任何想法如何解决这个问题?

有没有一种方法可以定义每个应用程序的默认字体? 每个布局?

TextView中的希伯来语“开箱即用”效果很好。 BIDI可能存在问题,但是通常它显示的很好。

关于第二个问题,如何设置使用希伯来语时要使用的布局,请看一下: android中的RTL语言支持和资源限定符

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM