Android版的LinearLayout使按钮不起作用 [英] Android LinearLayout make button doesn't work

查看:237
本文介绍了Android版的LinearLayout使按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的布局的按钮,他们工作得很好。我希望把在同一行的两个按钮,所以我做的LinearLayout水平,但是当我这样做,第二个按钮的Click事件不起作用。它不显示我的TextView

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>

如果我删除它工作正常的的LinearLayout,但我想的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.

推荐答案

安卓layout_height =match_parent//&LT; ----------------------这是问题使经量

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

这篇关于Android版的LinearLayout使按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆