Android Layout How to?
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dip">
<Button
android:text="Edit"
android:width="50dip"
android:layout_height="fill_parent"
android:layout_width="wrap_content开发者_开发问答"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<ToggleButton
android:textOn="All"
android:textOff="Wishlist"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true" />
<Button
android:text="+"
android:width="50dip"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
I have these three buttons I want to align them in a similar fashion to the iphone version. I've tried using gravity and things but I can't seem to get them to look the same without absolute positioning.
Thanks
So I figured it out. I replaced my original code with the solution if any one happens to need it.
I was able to get pretty close with this layout:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dip">
<Button
android:text="Edit"
android:width="50dip"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"/>
<ToggleButton
android:text="Toggle"
android:textOn="All"
android:textOff="Wishlist"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"/>
<Button
android:text="+"
android:width="50dip"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"/>
</RelativeLayout>
I would personally use a TableLayout to accomplish that.
精彩评论