0

I have a navigation drawer and i want to add a second title using code

I know that using this code i can add the first title

    View header = View.inflate(this, R.layout.aaaaaaa, null);
    mDrawerList.addHeaderView(header, null, false);

But i do not understand how to add a new second title ...

Example: "Recent Labels"

enter image description here

So what i do:

    dataList = new ArrayList<DrawerItem>();

        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

        mDrawerList = (ListView) findViewById(R.id.left_drawer);

        adapter = new CustomDrawerAdapter(this, R.layout.aaaaaaaaaaaaaa,
                dataList);
         View header = View.inflate(this, R.layout.header, null);

        mDrawerList.addHeaderView(header, null, false);
            mDrawerList.setAdapter(adapter);// Then I cannot add second title
 dataList.add(new DrawerItem("One ",R.drawable.aa));
 dataList.add(new DrawerItem("Two",R.drawable.aa));
//How to add new title????
Sam
  • 7,252
  • 16
  • 46
  • 65
Device
  • 993
  • 3
  • 11
  • 26

1 Answers1

0

That's nothing but a sectioned listview by defining a custom adapter. Learn and implement from ListView Tips & Tricks #2: Sectioning Your ListView

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295