我需要一些帮助。我正在使用此EnhanceListView来轻扫以在我的alertDialog中解除但是滑动不起作用。刷卡解除是否对alertdialog不起作用?或者我错过了什么。?我尝试设置方向但仍无效。
这是我的代码
public void viewDataList() {
LayoutInflater inflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.alert_opendata, null);
lv = (EnhancedListView) view
.findViewById(R.id.data_list);
TextView emptyText = (TextView) view.findViewById(android.R.id.empty);
lv.setEmptyView(emptyText);
DisplayDataAdapter adapter = displayData();
lv.setAdapter(adapter);
lv.setDismissCallback(new OnDismissCallback() {
@Override
public Undoable onDismiss(EnhancedListView arg0, int arg1) {
// TODO Auto-generated method stub
return null;
}
});
lv.setSwipingLayout(R.id.swiping_layout);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setView(view);
builder.setNegativeButton("Close",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
return;
}
});
builder.create().show();
}
我的xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<de.timroes.android.listview.EnhancedListView
android:id="@+id/data_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C0C0C0"
android:minHeight="30dp" >
</de.timroes.android.listview.EnhancedListView>
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="No Data"
android:textSize="20sp" />
</LinearLayout>
我的清单项目
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swiping_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="2dp"
android:background="#F8f8f8"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="@+id/datalist_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F8f8f8"
android:padding="10dp"
android:textSize="20sp" >
</TextView>
</LinearLayout>
答案 0 :(得分:0)
我没有看到你设置lv.enableSwipeToDismiss();
另外,您可能想添加以下内容:
lv.setUndoStyle(EnhancedListView.UndoStyle.MULTILEVEL_POPUP);
lv.setSwipeDirection(EnhancedListView.SwipeDirection.BOTH);