开发者

Adding custom list adapter to a TableLayout

I have a custom list adapter inside of a TableLayout. This TableLayout is nested inside a of a LinearLayout.

The list adapter expands if new childviews are added to the list. I want the size of the TableRow to increase dynamically when the size of the list adapter increases. And the buttons pushed down when the list grows.

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

        <LinearLayout">
            <!-- Draw header + sub title -->
            <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" >
                <TextView ></TextVie开发者_运维知识库w>
                <TextView ></TextView>
            </LinearLayout>

            <LinearLayout android:orientation="horizontal">
                <ImageView />
                <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" 
                    android:layout_weight="1">
                    <TableLayout android:layout_height="fill_parent" android:layout_width="fill_parent"  android:layout_weight="1">
                        <TableRow android:id="@+id/tr1">
                            <CustomList android:id="@+id/mainview"
                                ndroid:layout_height="wrap_content" android:layout_width="wrap_content" />
                        </TableRow>
                        <TableRow android:layout_height="wrap_content"
                            android:layout_width="match_parent">
                            <Button android:layout_width="wrap_content" android:id="@+id/button1"
                                android:text="@string/buttonPrevious" android:layout_height="wrap_content">
                            </Button>
                            <Button android:layout_width="wrap_content" android:id="@+id/button2"
                                android:text="@string/buttonNext" android:layout_height="wrap_content"></Button>
                        </TableRow>
                    </TableLayout>
                </LinearLayout>
                <ImageView  />

        </LinearLayout>
    </ScrollView>

Do I have to do change something like change the way layouts are inflated in my custom list adapter or anything else?


Please read the following question and answers. I believe this may be the same thing you are trying to achieve

Android ListView that does not scroll?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜