java - Android ExpandedListView want SwipeToDismiss to only work on Groups -


I have found here that is the real fact of swipodisz implementation.

And it works great though, I am using it on an extendedlistview and I would prefer only to sack the groups.

There can be two places where I can interfere and do not allow to be dismissed, in the Touch Alicher event:

  mListView.setOnTouchListener (New View.OnTouchListener () {@Override Public Boolean onTouch (see, MotionEvent motionEvent) {if not // returning unrealistic return to a group ??????? Return mSwipeDismissTouchListener.OnTouch (see, motionEvent); ..  

Or in SwipeSystem LIVE V Touch Listener Event:

  mSwipeDismissTouchListener = New Swipe Dismiss ListUpout List of public voidDismiss (ListView list) on list, list of list (LISTView, New SwipeDist ListView Touch Listener.Disemal Callback () {Public Bully CanDismiss (Ent State) {// Return false if not on a group ???????} [] Reverse-sated posts) {}});  

but I can not tell what is CL

TIA.

You need to adopt your adapter class, but with some modifications: make it public And, make your field public, something like that

  view public static classesHilderGroups {TextView TVName; ImageView ivLogo; Public Boolean Group; }  

and some variables can be set, which defines the wheater

  @Override Public View getGroupView (int groupPosition, Boolean is Extended, see the convertview , ViewGroup Parent) {ViewHolderGroup Holder; If (convertView == empty) {layoutInfleter inflator = (layout inflator) this.context .getSystemService (context.LAYOUT_INFLATER_SERVICE); ConvertView = InflationInflat (R.Lailout.OroGroup_Operator, blank); Holder = ViewHaller Group (); Holder. TvName = (TextView) ConvertViewFindVBIID (R.id.layout_row_group_operator_tv_Name); Holder.evlogo = (ImageView) ConvertViewfindVBID (RIDlayout_OR_GrawM_Operator_IV_Logos); Holder.ivLogo.setVisibility (View.GONE); Holder.isGroup = true; // Here we are setting the field to know the group convert widgets tag (holder); } And {holder = (seeholder group) Convertview.gettag (); } ....}  

Then get this tag in the code you mentioned earlier, like

  @Override Public View Creatives (LayoutEfletter Inflator, View Group container, bundle saved instenstate) {fa = this; See Routview = Inflator.Inflat (R. Lite Fiji_list, Container, False); Final Expandable Reviewview Elman = (Expandable Listview) Routeview. FINFIIID (RID.Loutout_FG_Listlist_LL_Im); Route Expandable List Adapter Roots Adapter = New Way Expandable List Adapters (Randys.micentext, Rendisdets, Randys. Route); ElMain.setAdapter (routesAdapter); RegisterForContextMenu (elMain); ElMain.setOnChildClickListener (this); ElMain.setOnTouchListener (New View.OnTouchListener) {@Override Public Boolean OnTouch (see V, MotionEvent motionEvent) {Rect Read = New Rect;) Integer childCount = elMain.getChildCount (); int [] listViewCoords = new int [2] ]; ElMain.getLocationOnScreen (listViewCoords); integer x = (int) motionEvent.getRawX () --listViewCoords [0]; integer y = (int) motionEvent.getRawY () - listViewCoords [1]; Int = 0; i & lt; childCount; i ++) {children = elMain.getChildAt (i); child.getHitRect (Rect); if (rect.contains (x, y)) {RouteExpandableListAdapter.ViewHolderGroup holder = (RouteExpandableListAdapter .ViewHolderGroup) child .getTag (); if (holder. IsGroup) {// what you do Want] break;}} ratty rn false;}}); Return root view; }  

Hope this will help


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -