Android Drawer Layout Can't Find R.layout.drawer_list
Asked Answered
T

1

11

I am about two weeks in to Android development, and I'm sure there is a very simple answer to this, but will be needing to create a drawer slider for my application. Unfortunately, I cannot seem to find R.layout.drawer_list for my adapter set-up. I currently have a listView, but want this to be in a sliding drawer. I follow the api guides on developer.android and can't seem to get past this:

mDrawerList.setAdapter(new ArrayAdapter<String>(this,                
        R.layout.drawer_list_item, mPlanetTitles));

Now this is just pasted from developer.android but what it all comes down to is that eclipse can't find R.layout.drawer_list_item. I get no list of options from R.layout, but do receive a list from android.R.layout... unfortunately, that list doesn't contain the drawer_list_item option.

Any help would be greatly appreciated.

Timekeeper answered 27/1, 2014 at 21:27 Comment(2)
make sure you have your own R-file in your importsTrapshooting
developer.android.com/samples/NavigationDrawer/res/layout/…Ovotestis
K
16

You'll have to create the R.layout.drawer_list_item layout yourself (it need only be a simple layout with a TextView; the layout is the one that represents one item in your drawer list). Have you downloaded the sample app? You can copy&paste most stuff, get it working and then go from there.

Kafiristan answered 27/1, 2014 at 21:34 Comment(2)
Thank you! I should have dl'ed that sample. I thought it was a built in layout like the simple_expandable_list. Saves me a whole lot of trouble. Will accept as answer in a moment. Thanks againTimekeeper
No problem. You can also play a bit with the sample app to see which element / layout does what ;)Kafiristan

© 2022 - 2024 — McMap. All rights reserved.