Animation for expandableListView

It can be done using a simple ListView that contains an initially hidden view and a custom class that extends Animation. The basic idea is to start with View.GONE then gradually re-size the margin from a negative value to the required size while setting visibility to View.VISIBLE. See: https://github.com/tjerkw/Android-SlideExpandableListView Android Animation: Hide/Show Menu How do … Read more

Default Navigation Drawer View to ExpandableListView

This is the code for expandable list adapter: public class ExpandListAdapter extends BaseExpandableListAdapter { private Context _context; private List<String> _listDataHeader; // header titles // child data in format of header title, child title private HashMap<String, List<String>> _listDataChild; public ExpandListAdapter(Context context, List<String> listDataHeader, HashMap<String, List<String>> listChildData) { this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; … Read more

Values of counter changes after scrolling ExpendableListView

It is not a good idea to store quantity in ViewHolder. Hope below sample helps 🙂 MainActivity.java: public class MainActivity extends Activity { Button clearChecks, putOrder; ExpandableListView expandableListView; ExpandableListViewAdapter expandableListAdapter; int lastExpandedPosition = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); expandableListView = findViewById(R.id.expandedListView); clearChecks = findViewById(R.id.btnClearChecks); putOrder = findViewById(R.id.btnPutOrder); List<String> listTitle = genGroupList(); … Read more

How to create Expandable ListView in Flutter

Try this: import ‘package:flutter/material.dart’; void main() => runApp(MaterialApp(home: MyApp(), debugShowCheckedModeBanner: false,),); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return Scaffold( body: ListView.builder( itemCount: vehicles.length, itemBuilder: (context, i) { return ExpansionTile( title: Text(vehicles[i].title, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic),), children: <Widget>[ … Read more

Change expandable indicator in ExpandableListView

expandable listview <ExpandableListView android:id=”@+id/expandable_list” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:groupIndicator=”@drawable/group_indicator” android:transcriptMode=”alwaysScroll” /> setindicator here iam useing setindicator code like this this working nice DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int width = metrics.widthPixels; mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list); mExpandableList.setIndicatorBounds(width – GetPixelFromDips(50), width – GetPixelFromDips(10)); public int GetPixelFromDips(float pixels) { // Get the screen’s density scale final float scale = getResources().getDisplayMetrics().density; … Read more

Android – NestedScrollView which contains ExpandableListView doesn’t scroll when expanded

You can use NonScrollExpandableListView you can achieve non-scroll property of any Lisview or GridView or ExpandableListView by overriding following method. @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); ViewGroup.LayoutParams params = getLayoutParams(); params.height = getMeasuredHeight(); } So for using NonScrollExpandableListView you need to make one … Read more

Android: 2 or more ExpandableListView inside Navigation Drawer

Finally i have got it! This is the code I created to get an ExpandableListView with section titles. Now it’s I can easily create three xml custom layouts for titles, groups and childrens. It work for me, but I accept any code improvements to optimize memory usage, speed and so on. // ——————————————————————————————— // NAVIGATION … Read more

Programmatically collapse a group in ExpandableListView

Try putting this in your ExpandableListAdapter, listView is a reference to the ExpandableListView itself. And lastExpandedGroupPosition is a integer member variable defined inside your ExpandableListAdapter. @Override public void onGroupExpanded(int groupPosition){ //collapse the old expanded group, if not the same //as new group to expand if(groupPosition != lastExpandedGroupPosition){ listView.collapseGroup(lastExpandedGroupPosition); } super.onGroupExpanded(groupPosition); lastExpandedGroupPosition = groupPosition; }