2012-06-23 68 views
1

我的布局中有很多按钮,他们工作得很好。我想把两个按钮放在同一行,所以我将LinearLayout设置为水平,但是当我这样做时,第二个按钮的click事件不起作用。它不显示我的TextViewAndroid的LinearLayout使按钮不起作用

<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,因为我想两个按钮是在同一行。

+1

它看起来很好可以把完整的布局和代码在这里......... –

+1

@DheereshSingh这里的XML布局http://www.mediafire.com/?af87gxppl76ad0c和这里的活动http://www.mediafire .com /?dgmz1z42sz3fxdn,按钮不起作用是ShotHint – user1476841

+0

@DheereshSingh你离开了吗? – user1476841

回答

0

机器人:layout_height = “match_parent” // < ----------------------这是问题使其弯曲内容

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

谢谢,它的作品,真的很感谢你的男人 – user1476841

+0

永远欢迎...... :) –