tags:

views:

40

answers:

1

I'm having this odd issue. I have these buttons where the button's text is shifted downward upon certain actions. For example, I have a spinner with choices and one of the choices makes some buttons invisible while others are made visible. When I choose these, the buttons made visible all have their text shifted downward. Nothing else is shifted, just the text on the buttons. I've tried this on 1.5 and it works fine, no text is shifted, but I have issues with 2.1 and I really cannot figure it out. Any ideas or help would be great. Thanks.

Here is the xml of the file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">


<TableLayout android:id="@+id/testpracHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true">
    <!-- android:background="#ff0000"-->

    <TableRow>
        <Spinner android:id="@+id/testprac_menu" 
            android:layout_width="200px" 
            android:layout_height="wrap_content"></Spinner>
        <View android:id="@+id/header_space_buffer" 
            android:layout_width="40px" 
            android:layout_height="30px"
            android:gravity="center"></View>
        <Button android:text="New" 
            android:id="@+id/newInterval" 
            android:layout_width="80px" 
            android:layout_height="wrap_content"></Button>
    </TableRow>
</TableLayout>

<TableLayout android:id="@+id/bottomStruct" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
    <TableRow>
        <Button android:layout_width="80px" 
            android:text="Replay" 
            android:id="@+id/replay" 
            android:layout_height="wrap_content"></Button>
        <Button android:id="@+id/playInterval" 
            android:text="Play"
            android:layout_width="160px" 
            android:layout_height="wrap_content"></Button>
        <Button android:text="Submit" 
            android:id="@+id/submit" 
            android:layout_width="80px" 
            android:layout_height="wrap_content"></Button>
    </TableRow>
</TableLayout>

</RelativeLayout>

When i use the testprac spinner, the replay, new and submit buttons go invisible and the play button becomes visible (which is what I want). This seems to be when the issue seems to start. The play button's text is completely gone (probably shifted to low to see) and when I go back to the other button's are visible I get the issue that is shown below. The left is the issue before using the spinner, and the right is the issue. I don't know if it is just the spinner that causes this.

The GUI before I invoke the spinner The GUI after I invoke the spinner

A: 

The text is shifted inside the button? Could be a bug. Have you tried it on Android 2.2?

Shade
Yeah it shifted inside the button. The button's placement and everything else is still fine. I'll have to try it on 2.2. I'll see if I can provide a photo.
Fizz
Is setVisibility () the only method that you call in relation to these buttons? Have you tried with View.GONE instead of View.INVISIBLE? Is this orientation dependent?
Shade
The View.GONE is not exactly what I want. Although, I did move the buttons a lot higher (than what is shown in the picture) and they did not have that issue anymore. Could the issue be because of a bug with the command android:layout_alignParentBottom?
Fizz
It seems to be an issue with the android:layout_width="fill_parent". I changed this to android:layout_width="wrap_content" and it worked fine. I don't know really why "fill_parent" was an issue in 2.1 but not 1.5.
Fizz