Android 文本在某些设备上被截断

标签 android text textview clip

我在一部手机上遇到了问题(到目前为止)。我的应用程序使用印地语字体。它在模拟器、选项卡和许多其他手机上也显示良好。但是我用于测试目的的其中一部手机显示的文字是从侧面切掉的。

我尝试了几乎所有的方法来将它按正确的顺序排列,但没有一个奏效。这里贴出我的两部测试手机的截图和文字。

错误截图:

http://virtualcolors.net/akki/stmd/error.jpg

其他手机的截图:和预期的一样:

http://virtualcolors.net/akki/stmd/correct.jpg

可能是什么原因,我该如何解决?请告诉我!!

我正在使用的 TextView 配置:

<TextView
    android:id="@+id/A_lbl_mandir"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:text="@string/Abt_mandir"
    android:textAlignment="center"
    android:textColor="#80000A"
    android:textSize="35sp" />

编辑:我完整的 Activity xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
    android:layout_width="wrap_content"
    android:id="@+id/text"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:text="@string/hello_world" />
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/text" >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:padding="5sp"
    android:text="@string/test"/>
</ScrollView>

</RelativeLayout>

我已经尝试并删除了许多其他内容,特别是针对这部手机。但是无法解决问题!

最佳答案

这发生在 4.1.2 中,在 Google 中被记录为错误,他们已在 4.2 中修复。

https://code.google.com/p/android/issues/detail?id=34432

Android 操作系统无法计算文本长度的 unicode 字体会发生这种情况。

关于Android 文本在某些设备上被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22577552/

相关文章:

android - 有人知道如何解决Android Studio中的 Ivy 依赖吗?

c - 将西里尔符号保存在 C 中的 txt 文件中

linux - 按数据 block 内的字符对文件进行排序

java - 如何计算在 TextView 中看到的字母数量?

android - 从布局中移除子项

android - TextView 返回错误的文本大小

android - 在 onActivityResult 中检测电子邮件是否已发送

java - 带有来自 Volley 的 json 数据的 MPAndroid 图表

android - 混合列表 Activity

javascript - 如何一个字一个字地写?