0

テキストフィールドのセットを絶対レイアウトに揃える必要があります。ここに画像を投稿しています。これらのテキストフィールドを垂直方向と水平方向に揃えたいと思います。3セットしか表示しませんでしたが、実際のアプリでは最大10セットを追加したいと考えています。私にとって、それらを揃えることは非常に困難です。

ここに画像の説明を入力してください

私はAndroidの初心者開発者なので、これを行う方法がわかりません。これを行うための最良の方法を教えてください。

これが私のレイアウトコードです:

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

<EditText
    android:id="@+id/editText1"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="81dp"
    android:layout_y="56dp" />

<EditText
    android:id="@+id/EditText01"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="202dp"
    android:layout_y="58dp" />

<EditText
    android:id="@+id/EditText02"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="82dp"
    android:layout_y="130dp" />

<EditText
    android:id="@+id/EditText03"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="205dp"
    android:layout_y="127dp" />

<EditText
    android:id="@+id/EditText04"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="82dp"
    android:layout_y="197dp" />

<EditText
    android:id="@+id/EditText05"
    android:layout_width="78dp"
    android:layout_height="wrap_content"
    android:layout_x="205dp"
    android:layout_y="196dp" />

</AbsoluteLayout>
4

1 に答える 1

2

このように使用するTablelayout

<?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="fill_parent"
   android:orientation="vertical" >

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText21"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <EditText
            android:id="@+id/editText22"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText31"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <EditText
            android:id="@+id/editText32"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:padding="10dp" />
    </TableRow>
</TableLayout>

于 2012-11-17T04:32:36.560 に答える