Question

I've made my own custom button styles and they work splendid with some languages on my phones.

I've made strings.xml for DK and UK. However when I chose for instance france as language on my phone my buttons gets cut off in the bottom.

Can't seem to figure out why it does that.

Any ideas? I've tried on a HTC Hero, HTC Desire and a GarminAsus A10, all does the same.

Text getting cut off in the bottom...

EDIT layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@drawable/bg"
    android:padding="0dip">
    <LinearLayout android:id="@+id/linearLayout1"
        android:orientation="vertical" android:gravity="center"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:layout_marginLeft="40dip" android:layout_marginRight="40dip">
        <TextView android:layout_height="wrap_content"
            android:layout_width="fill_parent" android:id="@+id/hintUsername"
            android:text="@string/hintUsernameText" style="@style/CodeFont"></TextView>
        <EditText android:id="@+id/unameEditText"
            android:layout_height="wrap_content" android:layout_width="fill_parent"
            android:inputType="textPersonName" android:hint="@string/usernameHint">
            <requestFocus></requestFocus>
        </EditText>
        <TextView android:layout_height="wrap_content" android:id="@+id/textView1"
            android:layout_width="fill_parent" android:text="@string/hintPasswordText"
            style="@style/CodeFont"></TextView>
        <EditText android:id="@+id/pwEditText" android:layout_height="wrap_content"
            android:layout_width="fill_parent" android:inputType="textPassword"
            android:hint="@string/pwHint"></EditText>
        <CheckBox android:layout_height="wrap_content" android:id="@+id/rememberLoginCheckbox"
            android:text="@string/rememberLoginCheckbox" android:layout_width="fill_parent"
            android:gravity="center" style="@style/CodeFont"></CheckBox>
        <Button android:id="@+id/loginButton" android:text="@string/logonButton"
            android:layout_height="wrap_content" android:layout_width="fill_parent"
            android:background="@drawable/btn_custom" android:textSize="18dp"></Button>
        <TextView android:id="@+id/errorTextView" android:text=""
            android:layout_height="wrap_content" android:layout_width="fill_parent"
            android:textColor="#FF0000"></TextView>
    </LinearLayout>
</LinearLayout>

Background for custom button:

Normal button

I guess there is a possibility that my ninepatch is wrongly created, but it looks right when chosing danish or english language on my phones.

Was it helpful?

Solution

Ok, so I've solved this myself.

After going through my styles.xml file I found out that I had fixated the height of the buttons by 25dip. This looked right when my phones was using Danish or English language, but when changing it to any other language the button text was cut off, as shown on the picture in my previous post.

So the answer is to remove the height inside the styles.xml file and just set the height to wrap_content.

I don't know if this is a bug in the Android api, but I am going to report it and see what happens. It's really odd that it doesn't happen for those two languages but for every other language - I even tried to add a values folder for another language and added the same files from the default values folder that was used, but it didn't help.

So much for following tutorials blindly on the interwebs :P

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