0

If I create a navigation drawer without nothing, it works perfectly. If i.e. I call

setContentView(R.layout.screen_one);

for to show another screen, the navigation drawer doesn't work anymore. I press the button on the action bar but nothing to do.

Where is the mistake? Thanks

Boris Karloff
  • 1,190
  • 12
  • 20
  • Show more code please ! Ur xml file and ur class too so we can help u. Your question is not clear too, please update it with more details – Kosh May 12 '14 at 15:07
  • Check this http://stackoverflow.com/questions/23476645/android-navigation-drawer-implemented-with-activities/23477100#23477100 and http://stackoverflow.com/questions/23518555/android-navigation-drawers-and-fragments/23518942#23518942 – Libin May 12 '14 at 15:16
  • Make sure that the screen_one layout has the drawer layout defined too. – Shivam Verma May 12 '14 at 15:53

2 Answers2

0

I think you are calling this

setContentView(R.layout.screen_one);

in a new class/activity.

This new screen when you call, it sits on top of your old screen. But your navigation drawer is attached to previous screen, so it doesn't work as all your touch events are happening on the new screen.

Kaustuv
  • 811
  • 5
  • 9
  • It is the same class and activity, and for sure happens that u wrote. How can i Fix it? – Boris Karloff May 12 '14 at 15:16
  • check link given by Libin above. Depending upon what suits you best you can either have a base activity that takes care of all common things required by other activities of your app or you can use fragments inside one activity, which of-course will have drawer attached to it. – Kaustuv May 12 '14 at 15:33
0

Check out this Nav Drawer implementation sample according to Material Design.

If you have doubts about it just check out this 3 articles about it.

  1. Material Design Nav Drawer: Sizing
  2. Material Design Nav Drawer: Styling
  3. Material Design Nav Drawer: Navigating

It's recommended to use the Android Support Design library that will make your life easy.

Sotti
  • 14,089
  • 2
  • 50
  • 43