我试图让一个图像旁边有一个按钮,当我运行代码时,我只是在屏幕左侧得到图像,没有按钮,无论我是否首先列出了图像。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<ImageView
android:id="@+id/imageView1"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:contentDescription="@string/none"
android:src="@drawable/oxwichpointtest" />
<Button
android:id="@+id/button1"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:onClick="openGuide"
android:text="@string/button_text" />
</LinearLayout>
更新:感谢所有建议。我已经全部尝试过了,但我的应用程序布局没有任何变化,所以我怀疑问题在于我如何在 .java 文件中设置图像。我将尝试更改它并希望它会起作用,或者如果我仍然遇到问题,我可以稍后在此处添加代码。再次感谢,至少我知道布局没有什么大问题。