layout ideas for android
I've been toying around with a lot of different layout structures and can't seem to find the best one for my solution.
Essentially I need 3 rows that each take up 33% (height) of the device (in landscape mode). I thought would be perfect, but I can't seem to find a way to specify the height of a . It's possible I've overlooked a property somewhere, but I can't find it in the docs. I also thought of as an option but after playing around with that for a bit, I'm not sure that's the best solution either.
Can accomplish what I need? I will have other layouts specified within my rows (RelativeLayout primarily), but I just need the core structure to be 3 rows of 33% height each.
EDIT - Added Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rellay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/table_background">
<LinearLayout
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Connect To Server" />
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:maxLines="6"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<RelativeLayout
android:id="@+id/cardssection"
android:layout_column="1" />
<Button
android:id="@+id/submitcards"
android:gravity="right"
android:maxWidth="10px"
android:text="Submit Cards"
android:layout_below="@id/label" />
开发者_如何学C </TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
Take a look here How to split the screen with two equal LinearLayouts?. You just need add one more row to the solution. Note android:orientation="vertical" at the top-level LinearLayout.
精彩评论