SwipeMenuListView视图在android中不一致

时间:2016-04-05 11:11:46

标签: android xml swipe-gesture

我使用了来自github的SwipeMenuListView它可以工作但是视图不像图片中那样一致

enter image description here

活动布局

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.robo.lolita.swipemenurecyclerview.MainActivity">
        <com.baoyz.swipemenulistview.SwipeMenuListView
            android:id="@+id/listView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </RelativeLayout>

这是简单的布局滑动菜单布局

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent" android:background="@android:color/holo_blue_bright">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/count"/>
    </LinearLayout>


  SwipeMenuCreator creator = new SwipeMenuCreator() {
            public void create(SwipeMenu menu) {
                SwipeMenuItem deleteItem = new SwipeMenuItem(
                        getApplicationContext());
                deleteItem.setBackground(new ColorDrawable(Color.rgb(0xF9,
                        0x3F, 0x25)));
                deleteItem.setWidth(dp2px(90));
                deleteItem.setIcon(R.drawable.camera_icn);
                menu.addMenuItem(deleteItem);

我需要在刷卡上将删除按钮附加到listview的项目。这个滑动菜单带有删除按钮。我想在单击删除按钮时删除该项目,但在swipemenulistview中视图不一致。任何帮助实现这一点。好吧,我不能轻易解雇,我知道我们不应该模仿其他平台的UI。但这是要求。

0 个答案:

没有答案