Button text loses allignment after clicking

Posted by breathe0 on Stack Overflow See other posts from Stack Overflow or by breathe0
Published on 2011-01-17T22:46:56Z Indexed on 2011/01/17 22:53 UTC
Read the original article Hit count: 230

Strange things happen. I have a 4x4 button table layout, which is the following:

        <TableLayout  
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_below="@+id/cerca">

        <TableRow
            android:layout_width = "fill_parent"
            android:layout_height = "wrap_content">

            <Button
                android:id = "@+id/btn1"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_weight="1"
                android:text = "Scarica POI da server"
                android:onClick="downloadFromServer"
            /> 
            <Button
                android:id = "@+id/btn2"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_weight="1"
                android:text = "Aggiungi POI"
                android:onClick="goCreatePOI"
            /> 
    </TableRow>
    <TableRow
        android:layout_width = "fill_parent"
        android:layout_height = "wrap_content"> 

            <Button
                android:id = "@+id/btn3"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"  
                android:layout_weight="1"
                android:text = "Rimuovi i POI del server"
                android:onClick="removeServerPOI"
            />   

            <Button
                android:id = "@+id/btn4"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_weight="1"
                android:text = "Rimuovi i POI personali"
                android:onClick="removePersonalPOI"
            />  

    </TableRow>   

</TableLayout>

This table layout is nested inside a relative layout, which is nested in a scrollview.

Now, whenever i click on one of them, everytime the text inside the button change allignment: if before clicking was centered and displayed on two lines, after the click it loses its alignment and is displayed only in one row (cutting off some part of the text). Am I doing something wrong, or maybe it's a bug?

© Stack Overflow or respective owner

Related posts about android

Related posts about button