forevernoob.blogg.se

Text expander app android
Text expander app android




  1. #Text expander app android android#
  2. #Text expander app android code#

#Text expander app android code#

In the above code the expandableListDetail object is used to map the group header strings to their respective children using an ArrayList of Strings. HashMap> expandableListDetail = new HashMap>() ĮxpandableListDetail.put("CRICKET TEAMS", cricket) ĮxpandableListDetail.put("FOOTBALL TEAMS", football) ĮxpandableListDetail.put("BASKETBALL TEAMS", basketball) The ExpandableListDataPump class is defined as below: The layout row of the child items is given below : The layout of the group header of each individual list is given below : Note : We cannot use the value wrap_content for the android:layout_height attribute of the ExpandableListView in XML unless the parent’s size is strictly specified The android:indicatorLeft is the left bound for an items indicator. The activity_main.xml layout consists of an ExpandableListView in a RelativeLayout as shown below :

#Text expander app android android#

A CustomExpandableListAdapter which provides the MainActivity with the data from the ExpandableListDataPump class/li> Android ExpandableListView Code.An ExpandableListDataPump which represents a random data in a List and maps the child item data to the respective group headers using a HashMap.

text expander app android

  • A MainActivity that shows the layout with the ExpandableListView.
  • ExpandableListView.OnGroupExpandListener : It is used to notify when a group is expandedĪndroid ExpandableListView Project Structure.
  • ExpandableListView.OnGroupCollapseListener : It is used for notifying when a group is collapsed.
  • ExpandableListView.OnGroupClickListener : This is overridden to implement the callback method that’s invoked when a group header in the expanded list is clicked.
  • ExpandableListView.OnChildClickListener : This is overridden to implement the callback method that’s invoked when a child in the expanded list is clicked.
  • The notable interfaces that are implemented by this class are given below :
  • getChildView() : It returns view for list child item.
  • getGroupView() : It returns view for the list group header.
  • text expander app android

    If the group is expanded, the state state_expanded will be set If the group is empty, the state state_empty will be set. setGroupIndicator(Drawable) : An indicator is drawn besides the group representing its state i.e.If the child is the last child for a group, the state state_last will be set setChildIndicator(Drawable) : This is used to show an indicator besides each item representing the current state.Following are some important methods that are used by this class :






    Text expander app android