0

私はAndroidアプリケーションに取り組んでおり、ユーザーがリストの特定のアイテムをスワイプしたときにボタンを表示したいと考えています.

これは、ボタンと他のいくつかの項目がある私の xaml です。リスト ビューでこの xml を使用しています。

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


    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:visibility="visible" android:id="@+id/tb1">

        <TableRow>
            <TextView android:id="@+id/createdBy" android:typeface="normal" 
                android:singleLine="true" android:textSize="14sp" android:textStyle="bold"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
        </TableRow>
        <TableRow>
            <TextView android:id="@+id/postText" android:typeface="normal"
                android:singleLine="true" android:textSize="14sp" android:textStyle="normal"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
                <Button android:id="@+id/btnDelete" android:textColor="#ffffff" android:visible="Gone"
                android:background="@color/hover_button" android:text="Delete"
                android:textSize="14sp" android:textStyle="normal" android:typeface="normal"
                android:layout_marginLeft="320dp" />
        </TableRow>
        <TableRow>
            <TextView android:id="@+id/postDate" android:typeface="normal"
                android:singleLine="true" android:textSize="14sp" android:textStyle="normal"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
        </TableRow>
    </TableLayout>
</RelativeLayout>

私はすでにグーグルで検索しましたが、私がアンドロイドに慣れていない例を理解できませんでした。助けてください。

4

2 に答える 2

2

次のリンクは、リストビューでスワイプ削除アクションを実装するのに役立ちます。

リストビューでのスワイプ削除操作

于 2012-10-18T11:16:46.473 に答える
0

47 度スワイプ リスト ビュー (究極の作品) を実装することをお勧めします。

スワイプ リスト ビューの実装の詳細については、こちらをご覧ください。

Android の ListView アイテムを iPhone のメール アプリのようにスライドさせる

47度のAndroid-SwipeListViewを実装するのに助けが必要

回答が役立つと思われる場合は、回答を受け入れて賛成票を投じてください。

于 2013-12-10T04:38:52.350 に答える