Back to project page swipelistview-android.
The source code is released under:
MIT License
If you think the Android project swipelistview-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.lion.swipelistview; /* w w w . j a va2 s . c o m*/ import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; public abstract class BaseSwipeAdapter extends BaseAdapter { private Context mContext; private SwipeListView mSwipeListView; public BaseSwipeAdapter(Context context, SwipeListView swipeListView) { this.mContext = context; this.mSwipeListView = swipeListView; } @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout layout = new LinearLayout(mContext); convertView = layout; layout.addView(generateLeftView()); layout.addView(generateRightView()); return convertView; } protected View generateLeftView() { View view = LayoutInflater.from(mContext).inflate(mSwipeListView.mSwipeLeftLayout, null, false); LinearLayout.LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); view.setLayoutParams(lp); return view; } protected View generateRightView() { View view = LayoutInflater.from(mContext).inflate(mSwipeListView.mSwipeRightLayout, null, false); LinearLayout.LayoutParams lp = new LayoutParams(mSwipeListView.mRightViewWidth, LayoutParams.MATCH_PARENT); view.setLayoutParams(lp); return view; } }