Android的设置与TextView的希伯来文? [英] Android setting with TextView for Hebrew text?

查看:263
本文介绍了Android的设置与TextView的希伯来文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从字符串资源设置中的TextView文本。通常情况下,希伯来语工作从右到左的格式。当我设置一个文本,它设置在LG,三星,索尼手机的文字从右到左的格式,但在HTC这是行不通的。它的工作原理在左到右格式的HTC。即使我把重力在Java文件中的TextView。

I am setting text in TextView from string resource. Normally, Hebrew works in Right-To-Left format. When I set a text, it sets the text Right-To-Left format in LG, Samsung, Sony Phone but in HTC it does not work. It works in Left-To-Right format in HTC. Even I set Gravity to the TextView in Java file.

在TextView的文本应根据画面尺寸是跨度。例如,如果是320×480,然后它在4行显示,但如果它是Galaxy Tab的话,有可能是2行。

Text in TextView should be span according to the screen size. For example if it is 320 x 480 then it display in 4 lines but if it is Galaxy Tab then there may be 2 lines.

下面是我的code片断:

Here is my Code snippet:

在Java的:

private TextView mVersionInfo, mVersionDescriptionOne, mVersionDescriptionTwo, mVersionDescriptionThree;

mVersionInfo = (TextView)findViewById(R.id.VersionInfo);
mVersionDescriptionOne = (TextView)findViewById(R.id.VersionDesc1);
mVersionDescriptionTwo = (TextView)findViewById(R.id.VersionDesc2);
mVersionDescriptionThree = (TextView)findViewById(R.id.VersionDesc3);

mVersionDescriptionOne.setGravity(Gravity.RIGHT);
mVersionDescriptionTwo.setGravity(Gravity.RIGHT);
mVersionDescriptionThree.setGravity(Gravity.RIGHT);

在XML:

<TextView android:id="@+id/VersionDesc1"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="@string/versiondesc1" android:textColor="#000000"
        android:layout_marginTop="5dip" android:gravity="right"
        android:layout_alignParentRight="true" android:layout_marginRight="10dip"
        android:layout_below="@+id/Share" android:textSize="13sp"
        android:layout_alignRight="@+id/Body" />
    <TextView android:id="@+id/VersionDesc2"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="@string/versiondesc2" android:textColor="#000000"
        android:layout_alignParentRight="true" android:layout_marginRight="10dip"
        android:layout_below="@+id/VersionDesc1" android:textSize="13sp"
        android:layout_marginTop="5dip" android:gravity="right"
        android:layout_alignRight="@+id/Body" />
    <TextView android:id="@+id/VersionDesc3"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="@string/versiondesc3" android:textColor="#000000"
        android:layout_alignParentRight="true" android:layout_marginRight="10dip"
        android:layout_below="@+id/VersionDesc2" android:textSize="13sp"
        android:layout_marginTop="5dip" android:gravity="right"
        android:layout_alignRight="@+id/Body" />

在字符串资源:

<string name="versiondesc1">האפליקציה מתחברת לאתר הספק הסלולרי כדי להציג את מצב החשבון. לעיתים, כשאתר הספק איננו עובד תקין לא יהיה ניתן לקבל מידע. באם אתר הספק ישתנה האפליקציה עלולה להפסיק לעבוד. במצב כזה האפליקציה תחזור לעבודה תקינה מיד לאחר שאנו נתאים את שרת התוכנה שלנו לשינויים.</string>
<string name="versiondesc2">הערה: אנחנו לא מייצגים את חברות הסלולר ולא נמצאים איתן בקשר מסוג כלשהו!</string>
<string name="versiondesc3">אם נתקלת בבעיה, השתמש/י בכפתור יצירת קשר על מנת שנוכל לפתור אותה. נשמח לקבל כל משוב על האפליקציה.</string>

什么是错我的code?

What is wrong with my code?

如果谁曾与其他语言的工作,请指引我到这里来。

Anybody who has worked with another language, Please guide me here.

感谢。

推荐答案

重力只会影响到调整,并不会设定基本方向的文本。它工作在某些设备上,而不是其他人可能是字体的问题,或者可能是操作系统版本的问题。试着在你的文本的开始增加一个从右到左标记字符(\ u200F)。这可能有助于在显示器上的HTC和不会伤害就在那里已经工作设备的任何东西。

Gravity will only affect alignment and will not set base direction for the text. That it works on some devices and not others may be a font issue, or perhaps an OS version issue. Try adding a RIGHT-TO-LEFT MARK character (\u200F) at the start of your text. This might help the display on an HTC and will not hurt anything on devices where it is already working.

这篇关于Android的设置与TextView的希伯来文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆