2011-02-10 16 views
0

私はビジネスアプリのためのデザインをビルドしていて、オープニング画面のレイアウトに固執しています。ここにソースコードがあります。ここで画面は私の画面looks like nowhereのように見えます。Androidアプリ - 画像付きロギング画面(おそらくレイアウト問題)

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@color/background" 
    android:paddingTop="20dip" 
    > 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@color/background" 
    android:padding="40dip" 
    > 

     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:orientation="horizontal" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:background="@color/background" 
      > 
       <ImageView 
        android:id="@+id/test_image" 
        android:src="@drawable/user_lock" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
       /> 

      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="vertical" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:background="@color/background"> 
       <EditText 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/username" 
        android:maxLines="1" 
        /> 
       <EditText 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/password" 
        android:password="true" 
        /> 
     <TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:background="@color/background"> 

    <TableRow> 
     <Button 
     android:id="@+id/login_button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/login" 
     android:layout_weight="2" 

     /> 
    <Button 
     android:id="@+id/exit_button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/exit" 
     android:layout_weight="2" 
     /> 
     </TableRow> 

     </TableLayout> 
     </LinearLayout> 

     </LinearLayout> 
    </LinearLayout> 
</LinearLayout> 
+0

私はベストを尽くしていますが、なぜあなたはトピックから反応しているのか分かりません。 – Waypoint

+0

テーブルレイアウトは、2番目のLinearLayoutの外にある必要があります。 2番目のLinearLayoutは画像の右側になるように幅が制限されているためです。 –

+0

ありがとう、私はそれを試したが、その後ボタンが表示されません:( – Waypoint

答えて

1

をし、フォーマットが不適切です。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@color/background" 
android:padding="40dip" 
> 
<ImageView 
    android:id="@+id/test_image" 
    android:src="@drawable/user_lock" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
/> 
<EditText 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="@string/username" 
    android:maxLines="1" 
    android:layout_toRightOf="@id/test_image" 
/> 
<EditText 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="@string/password" 
    android:password="true" 
    android:layout_alignBottom="@id/test_image" 
    android:layout_toRightOf="@id/test_image" 
/> 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:layout_below="@id/test_image" 
> 
    <Button 
     android:id="@+id/login_button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/login" 
     android:layout_weight="2" 
    /> 
    <Button 
     android:id="@+id/exit_button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/exit" 
     android:layout_weight="2" 
    /> 
</LinearLayout> 
</RelativeLayout> 
+0

偉大な、まさに私が望んでいた、ありがとう! – Waypoint

0

この試してみてください:あなたのビューが(パフォーマンスと読みやすさに影響を与える)overcomplicatedている(ちょうどあなたが2のEditTextを持っているのLinearLayoutを閉じる)

(....) <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/background"> 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/username" 
      android:maxLines="1" 
      /> 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/password" 
      android:password="true" 
      /> 
</LinearLayout> 

<TableLayout (...) 

(...)

+0

答えをありがとう、しかし、私はそれを行うとき、ボタンは表示されません – Waypoint

関連する問題