Hey,

I fear you are approaching Android design as if you were coding for
HTML in the 90s. ;)

There is no real need for a table layout here. Heres an example of a
login dialog from the API Demos (samples/ApiDemos/res/layout/
alert_dialog_text_entry.xml):

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing,
software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
     See the License for the specific language governing permissions
and
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/username_view"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:text="@string/alert_dialog_username"
        android:gravity="left"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <EditText
        android:id="@+id/username_edit"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:scrollHorizontally="true"
        android:autoText="false"
        android:capitalize="none"
        android:gravity="fill_horizontal"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/password_view"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:text="@string/alert_dialog_password"
        android:gravity="left"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <EditText
        android:id="@+id/password_edit"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:scrollHorizontally="true"
        android:autoText="false"
        android:capitalize="none"
        android:gravity="fill_horizontal"
        android:password="true"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

Hope this helps.

Paul

On Sep 29, 7:56 am, Grinarn <danielwisc...@googlemail.com> wrote:
> Hi folks,
>
> i just started developing Android apps and i got a first question
> while designing the screen.
>
> What i want to do is do build a login screen.
> So i arranged my Labels and Editfields with a TableLayout in Rows.
> Below the fields, i want to place a Login Button and a below that, an
> image with a logo.
>
> So my idea was to place a TableLayout into a Relative Layout. so i can
> arrange my fields using a TableLayout and the Button and Image with
> the Relative Layout, but when i want to place my Button below the
> table, it appears in the topright corner.
>
> Here is my approach:
> <?xml version="1.0" encoding="utf-8"?>
>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                 android:layout_width="fill_parent"
>                 android:layout_height="wrap_content"
>                 android:padding="10px" >
>
> <TableLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:id="@+id/tableLay"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
> android:layout_height="wrap_content">
>
>     <TableRow android:minHeight="50px">
>                 <TextView
>                 android:text="@string/login_user"
>         android:paddingRight="20px"
> android:layout_gravity="center_vertical"/>
>         <EditText android:id="@+id/user"
>               android:layout_height="wrap_content"
>               android:background="@android:drawable/
> editbox_background" android:layout_width="200sp" android:lines="1"
> android:maxLength="15" android:inputType="text"
> android:layout_gravity="center_vertical" android:focusable="true"/>
>
>     </TableRow>
>         <TableRow android:minHeight="50px">
>                 <TextView
>                 android:text="@string/login_pass"
>                 android:paddingRight="20px"
> android:layout_gravity="center_vertical"/>
>         <EditText android:id="@+id/password"
>               android:layout_height="wrap_content"
>               android:background="@android:drawable/
> editbox_background" android:layout_width="200sp" android:lines="1"
> android:maxLength="15" android:inputType="textPassword"
> android:layout_gravity="center_vertical"/>
>
>     </TableRow>
>
>     <TableRow android:minHeight="50px">
>                 <TextView
>                 android:text="@string/login_licPlate"
>                 android:paddingRight="20px"
> android:layout_gravity="center_vertical"/>
>
>                 <EditText android:id="@+id/licPlate"
>               android:layout_height="wrap_content"
>               android:background="@android:drawable/
> editbox_background" android:lines="1" android:maxLength="15"
> android:inputType="text" android:layout_gravity="center_vertical"
> android:layout_width="wrap_content"/>
>         </TableRow>
>
> </TableLayout>
>
>         <Button android:id="@+id/login"
>             android:layout_width="wrap_content"
>             android:layout_height="wrap_content"
>             android:layout_below="@id/licPlate"
>             android:layout_alignParentRight="true"
>             android:layout_marginLeft="10px"
>             android:text="Login" />
>
> </RelativeLayout>
>
> Maybe someone can help me with that.
>
> Regards,
> Grinarn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to