0
我刚刚在学校开始Java编程,我的第一个任务是重新创建一个应用程序,我正在使用xml布局而不是以编程方式创建要素。我想要出现两个独立的线性布局,一个是水平的,一个是垂直的。我所有的水平布局看起来都很好,但每当我尝试添加垂直布局时,它都会添加,但不会显示。在仿真器中,我可以告诉它正在被添加,因为水平的LL被推送。垂直线性布局不显示,但水平在java xml文件中
下面的代码示例:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/randomButton"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="DERP" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="HIIIII" />
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Badoop" />
</LinearLayout>
</LinearLayout>
有什么建议?谢谢,
大卫
谢谢,这实际上这是它搞乱了0dip。一旦我将它设置为实际宽度,它就可以正常工作。谢谢你的回应:D – DaveyDaVinci