Saeid
Saeid

Reputation: 2321

How customize AndroidHive Slide Menu

for make a slidemenu i use AndroidHive.com slidemenu sample.

at first i make slidemenu in this form :

enter image description here

now i need to change to this form :

enter image description here

for change first row of listview i use this codes :

    View header = getLayoutInflater().inflate(R.layout.slidemenu_header, null);
    mDrawerList.addHeaderView(header); 

but for end of list items(item 10 & a,b,c,d items) , Whether there is a way that i can put them to SlideMenu listview?

or what i should to do?

it possible to inflate view to Desired position in Listview?

Upvotes: 0

Views: 3780

Answers (1)

Arash GM
Arash GM

Reputation: 10395

To having multiple view inside of your Sliding menu ListView you can override two functions inside of your menu adapter :

@Override
public int getViewTypeCount() {
    return 3;
}

@Override
public int getItemViewType(int position) {
      if (position == 0) {
        return 0;
      } else if(position == 1) {
        return 1;
      }
      else
      return 2;
}

then inside of your getView inflate the row according to the result from getItemViewType(position)

View rowView = convertView;
    int Layout;

    if(getItemViewType(position) == 0)//change layout according to being header or detail in ListView
    {
        Layout = R.layout.first_view;
    }
    else if(getItemViewType(position) == 1)
    {
        Layout = R.layout.second_view;
    }
    else
    {
        Layout = R.layout.third_view;
    }

Upvotes: 1

Related Questions