0

https://github.com/tjerkw/Android-SlideExpandableListView

したがって、上記のライブラリを使用して、次の場所に別のテキストビューを追加しました。

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

        <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/textA"
                android:text="Hello World"/>

        <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/textB"
                android:text="Hello World"/>

        <!-- this is the button that will trigger sliding of the expandable view -->
        <Button
                android:id="@+id/expandable_toggle_button"
                android:text="More"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/text"
                android:layout_alignParentRight="true"
                android:layout_alignTop="@id/text"/>

    </RelativeLayout>

    <!-- this is the expandable view that is initially hidden and will slide out when the more button is pressed -->
    <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:id="@+id/expandable"
            android:background="#000000">

        <!-- put whatever you want in the expandable view -->
        <Button
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="0.5"
                android:text="Action A" />

        <Button
                android:id="@+id/details"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="0.5"
                android:text="Action B"/>

    </LinearLayout>
</LinearLayout>

リストアダプターの設定では、R.id.TextA を 1 つだけ指定できます。2 つの textViews の 2 つの項目リストをどのように指定できますか。

4

1 に答える 1

1

おそらく答えるには遅すぎますが、SimpleCursorAdapter を使用すると、次のように TextViews の配列を渡すことができます。

SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, 
            R.layout.expandable_list_item, c, 
            new String[] {DB_COL_A, DB_COL_B}, 
            new int[] {R.id.textA, R.id.textB});
于 2013-10-04T12:25:57.157 に答える