You want to use the XML attribute *android:layout_weight="1"* so that the
element will take up as much space as it can. I edited your layout and
posted a working version below.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
>

       <TableLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
       >
               <TableRow>
                       <TextView
                               android:layout_width="wrap_content"
                               android:layout_height="wrap_content"
                               android:text="Artist"
                               android:padding="10sp"
                       />
                       <EditText
                               android:layout_weight="1"
                               android:layout_height="wrap_content"
                               android:layout_marginRight="10sp"
                               android:singleLine="true"
                       />
               </TableRow>

               <TableRow>
                       <TextView
                               android:layout_width="wrap_content"
                               android:layout_height="wrap_content"
                               android:text="Title"
                               android:padding="10sp"
                       />
                       <EditText
                               android:layout_weight="1"
                               android:layout_height="wrap_content"
                               android:layout_marginRight="10sp"
                               android:singleLine="true"
                       />
               </TableRow>
       </TableLayout>

</LinearLayout>

On Sat, Oct 4, 2008 at 10:25 AM, Znupi <[EMAIL PROTECTED]> wrote:

>
> Here's what I want: two simple input fields, one labeled "Artist" and
> one "Title". Basically:
> Artist   [ input ]
> Title    [ input ]
> The two input fields (EditTexts) need to be aligned on a vertical
> axis, so that the application looks good. Thus, I used the TableLayout
> View. Unfortunately, it seems I just can't get the table cells to
> expand all the way. So here's how my layout looks like (the |
> represends the margin of the screen):
> Artist   [ input ]               |
> Title    [ input ]               |
> But I want the input fields to expand all the way. I could probably do
> it with a fixed width, but I don't think that's a good idea. Here's my
> main.xml file:
> ------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>    android:orientation="vertical"
>    android:layout_width="fill_parent"
>    android:layout_height="fill_parent"
> >
>
>        <TableLayout
>                android:layout_width="fill_parent"
>                android:layout_height="wrap_content"
>        >
>                <TableRow android:layout_width="fill_parent">
>                        <TextView
>                                android:layout_width="wrap_content"
>                                android:layout_height="wrap_content"
>                                android:text="@string/artist"
>                                android:padding="10sp"
>                        />
>                        <EditText
>                                android:layout_width="fill_parent"
>                                android:layout_height="wrap_content"
>                                android:layout_marginRight="10sp"
>                                android:singleLine="true"
>                        />
>                </TableRow>
>
>                <TableRow android:layout_width="fill_parent">
>                        <TextView
>                                android:layout_width="wrap_content"
>                                android:layout_height="wrap_content"
>                                android:text="@string/title"
>                                android:padding="10sp"
>                        />
>                        <EditText
>                                android:layout_width="fill_parent"
>                                android:layout_height="wrap_content"
>                                android:layout_marginRight="10sp"
>                                android:singleLine="true"
>                        />
>                </TableRow>
>        </TableLayout>
>
> </LinearLayout>
> ------------------------------------------------
> BTW, I know the <LinearLayout> is not currently needed, but I'll have
> to add some things below the table.
>
> Thanks,
> Felix.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to