我想准备一个与下面附加图像相同的布局。android-问题在布局
我的问题都表示在图片:
- 我尝试建立按钮完全相同(宽度)在图像
- 表示为1我尝试设置“保存”和“取消“按钮在下面等宽。
我曾与下面的XML布局试了一下:
<RelativeLayout
android:id="@+id/widget38"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="5dp">
<TextView
android:layout_width="wrap_content"
android:id="@+id/textView1"
android:text="Event"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content">
</TextView>
<EditText
android:layout_width="fill_parent"
android:id="@+id/editText1"
android:layout_alignParentLeft="true"
android:hint="Tap to enter title"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1">
</EditText>
<View
android:id="@+id/separator"
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"
android:layout_centerVertical ="true"
android:layout_below="@+id/editText1"/>
<TextView
android:layout_width="wrap_content"
android:id="@+id/textView2"
android:text="From"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content"
android:layout_below="@+id/separator"
android:layout_marginTop="5dp">
</TextView>
<Button
android:layout_width="wrap_content"
android:id="@+id/button1"
android:layout_alignParentLeft="true"
android:text="Button"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2">
</Button>
<Button
android:layout_width="wrap_content"
android:id="@+id/button2"
android:text="Button"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/button1"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button1"
android:layout_below="@+id/button1">
</Button>
<View
android:id="@+id/separator1"
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"
android:layout_centerVertical ="true"
android:layout_below="@+id/button2"/>
<TextView
android:layout_width="wrap_content"
android:id="@+id/textView3"
android:text="To"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content"
android:layout_below="@+id/separator1"
android:layout_marginTop="5dp">
</TextView>
<Button
android:layout_width="wrap_content"
android:id="@+id/button3"
android:layout_alignParentLeft="true"
android:text="Button"
android:layout_height="wrap_content"
android:layout_below="@+id/textView3">
</Button>
<Button
android:layout_width="wrap_content"
android:id="@+id/button4"
android:text="Button"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/button3"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button3"
android:layout_below="@+id/button3">
</Button>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
android:layout_alignParentBottom="true">
<Button android:layout_width="wrap_content" android:id="@+id/button5" android:layout_alignParentBottom="true" android:text="Save" android:layout_height="wrap_content"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/button6" android:layout_alignParentBottom="true" android:text="Cancel" android:layout_height="wrap_content" android:layout_toRightOf="@+id/button5"></Button>
</RelativeLayout>
</RelativeLayout>
我不知道你*问题*是什么。 – SK9 2011-02-24 14:21:58
他希望他的布局与图像中的布局相匹配。似乎对我很直接。 – 2011-02-24 14:25:39
对于OP,如果您可以发布由布局XML生成的布局图像,将会很有帮助。 – 2011-02-24 14:26:18