Android ExpandableListView - Looking for a tutorial
you can find working example of the expandable list view by following links:
ExpandableListView
Expandable ListView in ANDROID
Android Expandable ListView simple Example in android.
for click on child, you can handle this way.
getExpandableListView().setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// your code...
}
});
Hope this will help you.
Thanks..
Implementing an expandable listview in tab fragment
1) Call findViewById() on the View returned
findViewById in Fragment
2) Change the first argument in the ExpandableListAdapter from 'this' to 'getActivity()'
My new onCreateView looks like this:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.tab_expandable_list, container, false);
// get the listview
expListView = (ExpandableListView) view.findViewById(R.id.lvExp);
// preparing list data
prepareListData();
listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
return view;
}
ExpandableListview - How do I close the previous opened item, when another item is clicked?
So you need only one (or zero) expanded group at a time. Right? The following code will close the previously expanded group when you expand another one. Try it.
Here you go
final int[] prevExpandPosition = {-1};
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
if (prevExpandPosition[0] >= 0 && prevExpandPosition[0] != groupPosition) {
expandableListView.collapseGroup(prevExpandPosition[0]);
}
prevExpandPosition[0] = groupPosition;
}
});
ExpandableListView with Drag and Drop of List Items in Android
Yes sure you can implement Drag and Drop in List View.. Here is the Samples for Drag and Drop in List View.. Drag and Drop Sample.. Download Zip file from this part in the page -(You can find the project here.)
Related Topics
Google Glass Gdk: How to Communicate with Android Device
Cannot Resolve Method Setlatesteventinfo
How to Set Image from Url for Imageview
Listfragment Onlistitemclick Not Being Called
Sqlite Returned an Error Code of 14
How to Make a Actionbar Like Google Play That Fades in When Scrolling
How to Create an Android Application in Android Studio That Uses the Google Maps API V2
What Is the Meaning of Addtobackstack with Null Parameter
Http Connection Timeout on Android Not Working
Difference Between Ontouch and Onclick Android
List of Files in Assets Folder and Its Subfolders
How to Handle Multiple Countdown Timers in Listview
Starting Frame-By-Frame Animation
Differencebetween Fragment and Fragmentactivity