/ / GridView vs ListView - android, gridview

GridView vs ListView - android, gridview

ALL,

Snažím sa vytvoriť nasledujúce rozloženie:

abc   <Edit_text>
def   <Edit_text>

kde abc a def sú len textové popisky pre 2 zobrazenia EditText.

Rozhodol som sa na to skúsiť GridView, ale zrejme to nie je možné. Vždy dostávam nasledujúce usporiadanie:

abc             def
<Edit_text>     <Edit_text>

Mal by som ho zmeniť, aby sa stal ListView, alebo ho možno vykonať pomocou GridView?

Ďakujem.

[EDIT]

main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<GridView
android:id="@+id/shipping_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:gravity="center"
android:numColumns="2"
/>
<Button
android:id="@+id/shipping_address_accept"
android:text="@string/shipping_address_accept_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/android:TextAppearance.Large"
/>
</LinearLayout>

line.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/shipping_info_line_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/android:TextAppearance.Large"
/>
<EditText
android:id="@+id/shipping_info_line_value"
android:inputType="text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

[/ EDIT]

Ďakujem.

odpovede:

0 pre odpoveď č. 1

Na to by ste mohli použiť rozloženie tabuľky,

    <TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/label1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="abc" />

<EditText
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter text"/>
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/label2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="def" />

<EditText
android:id="@+id/text2
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter text"/>
</TableRow>


</TableLayout>