Frage

I have many buttons in my layout and they work well. I want to put the two buttons on the same row, so I make a LinearLayout horizontal, but when I do that, the second button's click event doesn't work. It doesn't show me my textview

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/bAnswerQuestoinShowChoices"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Show Choices"
            android:visibility="invisible" />

        <Button
            android:id="@+id/bAnswerQuestionShowHints"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Show Hint 1"
            android:visibility="invisible" />
    </LinearLayout>

If I remove the LinearLayout it works fine, but I want the linearlayout because I want the two buttons to be on the same row.

War es hilfreich?

Lösung

android:layout_height="match_parent" //<----------------------this is the issue make it warp content

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" //<----------------------this is the issue make it warp content
        android:orientation="horizontal" >
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top