开发者

XML layouts and a statement from SQLite

I would like to ask you, how is possible to make layout of my application for data from database. I have a template for statement data from database, but I don't know, how to add to this template some elements (as button, text etc) - the probl开发者_运维技巧em is, that after adding for example button to this layout will be this button showed so many times, what is the records in database. Specifically:

<TextView android:id="@+id/rowId" android:layout_width="fill_parent"
    android:layout_height="26dip" android:singleLine="true"
    android:textSize="20dip" android:textColor="#ffffff" android:text="Id..." />

<TextView android:id="@+id/rowDesc" android:layout_width="fill_parent"
    android:text="Descr..." android:layout_height="20dip"
    android:textSize="12dip" android:layout_below="@+id/rowId"
    android:layout_alignParentBottom="true" andfill_parentor="#ffffff" />

<ImageButton android:id="@+id/icon" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:src="@drawable/delete"
    android:gravity="right" android:layout_alignParentRight="true"
    android:onClick="onClick" />

<Button android:id="@+id/ok" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="40px"
        android:onClick="addItem"
        android:text="Add" />

I want that button put on the top and only once and under this button I would like to put the statement of the database... In this time the output of XML layout looks following:

TEXT1 TEXT2 BUTTON IMG-BUTTON

TEXT1 TEXT2 BUTTON IMG-BUTTON

TEXT1 TEXT2 BUTTON IMG-BUTTON

...

And I would like to edit the layout so:

BUTTON

TEXT1 TEXT2 IMG-BUTTON

TEXT1 TEXT2 IMG-BUTTON

TEXT1 TEXT2 IMG-BUTTON

...

But I don't know, how to edit layout for this purpose... So I will be very glad for every hints, how to do...

Thanks million times!


It's not clear where you add these widgets to. But if you're using ListView for example, you should move ok button from this layout file to a file with ListView.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜