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>

我已经在 google 上搜索过,但无法理解我是 android 新手的示例,请帮助我。

4

2 回答 2

2

以下链接将帮助您在列表视图中实现滑动删除操作。

在列表视图中滑动删除操作

于 2012-10-18T11:16:46.473 回答
0

我建议您实施 47Degree Swipe List View (Works Ultimate)

在此处获取有关实施滑动列表视图的更多信息,

在 Android 上滑动 ListView 项目,如 iPhone 邮件应用程序

需要帮助实现47度Android-SwipeListView

如果您发现它们有用,请接受并投票。

于 2013-12-10T04:38:52.350 回答