Question

I am facing an issue in one phone (till yet). My app uses Hindi fonts. It shows well on emulator, tab, many other phones too. But one of the phone which I am using for testing purpose is showing the text going cut from sides.

I tried almost everything for putting it in the right order but none worked. Here posting the screenshots of two of my test phones and the text.

The screenshot with error:

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

The screenshot of other phones: and the expected one too:

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

What could be the reason and how can I solve it? Please let me know!!

TextView configs I am using:

<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" />

EDIT: My complete 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>

I have tried and deleted many other things especially for this phone. But unable to solve the issue!

Was it helpful?

Solution 3

All right! Found another phone with same issue. In that phone too, the text was clipped. I guess there is some problem with the phone. Because even popular apps like Whatsapp has got the same problem on that device. The Hindi text was cut same as shown in the images above.

Possible fix for that issue: (if someone gets that n what I am doing now.) I realised that browser shows the hindi fonts well on that. So better make a native app on html, javascript especially for such devices and view the HTML using WebView.The application will get a little slow but we have to do it Until we get the actual problem creating it.

Please note: this is not a solution, but a fix to make that work. Better known as "JUGAAD" in hindi.

OTHER TIPS

this occurs in 4.1.2 and its documented as a bug in Google which they have fixed in 4.2.

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

This happens with unicode fonts where the Android OS is not able to calculate the length of the text.

try this.

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

On some phones (specially on Samsung ones) some custom fonts are cuted off (or clipped). I had this with custom italic font. Some say that you can edit font to add some kind of padding (i can't confirm that because my lack of knowledge of editing fonts) but: - EditText/TextView add some padding from xml - Ellipsize (on some devices messing with this helps displaying text correctly)

Also could you post screenshot with enabled developer options to draw layout bounds, this could help to resolve your problem if above solutions won't help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top