【发布时间】:2014-04-21 07:52:31
【问题描述】:
我正在尝试在我的主屏幕上创建一个菜单,但我看不到我创建的第二个按钮。我试过android:layout_below="@+id/score_button",但它给出了警告“无效的布局参数”
这是我的 xml 文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/score_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="scoreGame"
android:text="@string/score_button" />
<Button
android:id="@+id/settings_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_settings" />
</LinearLayout>
我注意到,xml 文件中最先放置的按钮就是我在设备上运行应用程序时显示的那个按钮。
提前感谢您的帮助,非常感谢。
【问题讨论】:
-
尝试设置android:layout_width="wrap_content"..!!!!
-
android:orientation="vertical"
-
并将按钮宽度设置为 android:layout_width="wrap_content"
标签: android android-layout android-linearlayout android-view