【发布时间】:2013-09-26 17:14:05
【问题描述】:
我正在尝试在 m TextView 中显示希伯来语文本。
我已阅读here 我需要将字体从默认的 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 有问题,但总体上显示它很好。
-
就是这样!我已经添加了我的 xml。我怎样才能解决这个被视为:图像和两行文本的权利:标题,日期?
标签: java android eclipse fonts