Android Open Source - ParallaxScroll Custom Expandable List Adapter






From Project

Back to project page ParallaxScroll.

License

The source code is released under:

MIT License

If you think the Android project ParallaxScroll listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nirhart.parallaxscrollexample;
// w w  w .  ja va2s . co m
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

public class CustomExpandableListAdapter extends BaseExpandableListAdapter {

  private LayoutInflater inflater;

  public CustomExpandableListAdapter(LayoutInflater inflater) {
    this.inflater = inflater;
  }

  @Override
  public String getChild(int groupPosition, int childPosition) {
    return "Group " + groupPosition + ", child " + childPosition;
  }

  @Override
  public long getChildId(int groupPosition, int childPosition) {
    return 0;
  }

  @Override
  public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    TextView textView = (TextView) convertView;
    if (textView == null)
      textView = (TextView) inflater.inflate(R.layout.item_child, null);
    textView.setText(getChild(groupPosition, childPosition));
    return textView;
  }

  @Override
  public int getChildrenCount(int groupPosition) {
    return groupPosition*2+1;
  }

  @Override
  public String getGroup(int groupPosition) {
    return "Group " + groupPosition;
  }

  @Override
  public int getGroupCount() {
    return 20;
  }

  @Override
  public long getGroupId(int groupPosition) {
    return 0;
  }

  @Override
  public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    TextView textView = (TextView) convertView;
    if (textView == null)
      textView = (TextView) inflater.inflate(R.layout.item, null);
    textView.setText(getGroup(groupPosition));
    return textView;
  }

  @Override
  public boolean hasStableIds() {
    return false;
  }

  @Override
  public boolean isChildSelectable(int groupPosition, int childPosition) {
    return false;
  }
}




Java Source Code List

com.nirhart.parallaxscroll.views.ParallaxExpandableListView.java
com.nirhart.parallaxscroll.views.ParallaxListViewHelper.java
com.nirhart.parallaxscroll.views.ParallaxListView.java
com.nirhart.parallaxscroll.views.ParallaxScrollView.java
com.nirhart.parallaxscroll.views.ParallaxedView.java
com.nirhart.parallaxscrollexample.CustomExpandableListAdapter.java
com.nirhart.parallaxscrollexample.CustomListAdapter.java
com.nirhart.parallaxscrollexample.MainActivity.java
com.nirhart.parallaxscrollexample.MultipleParallaxExpandableListView.java
com.nirhart.parallaxscrollexample.MultipleParallaxListView.java
com.nirhart.parallaxscrollexample.MultipleParallaxScrollView.java
com.nirhart.parallaxscrollexample.SingleParallaxAlphaScrollView.java
com.nirhart.parallaxscrollexample.SingleParallaxExpandableListView.java
com.nirhart.parallaxscrollexample.SingleParallaxListView.java
com.nirhart.parallaxscrollexample.SingleParallaxScrollView.java