17

I'm working on a Android project that only support API level > 14. As a consequence, we don't use the Android Support Library.

I would like to use the navigation drawer with the newer API, but all the documentation I found is about how to create navigation drawer using the support library.

How can I create a Activity with a navigation drawer using only the Android SDK with API level > 14?

Kuffs
  • 35,581
  • 10
  • 79
  • 92
Pierre-Jean
  • 1,872
  • 1
  • 15
  • 21
  • 2
    Robin, Kuffs, Booger, thank you all. You are all right, and I could set each of your answer as the good one. As I have to choose, I'll set Kuffs one because he redefines the features of the library which I prefer than "there is no issue to include it" or "don't pay too much attention to where it is from" to my mind. But all your answers were good! Thanks again! I'll vote up all your answers! – Pierre-Jean Mar 10 '14 at 20:02
  • 1
    Agree that this isn't trivial -- the docs are too cagey, they advocate "use as best practice", but then "it is important to consider what features you want to support and understand what features are supported by each library at what Android API level", and then the kicker, "features that are only available through the library APIs". They could be clear: "The support libs are part of the API and you need them to follow our design guides. 'Nuff said." – cdhabecker Mar 12 '14 at 23:42

3 Answers3

10

You simply use the support library as it contains the functionality you need. It does not matter that you do not want to use the other functionality contained within the library. It does contain the sliding menu that you want to use so just use it.

The alternative is to write your own code or use a different library.

Try not to think of the support library as "only for backwards compatibility". It provides functionality that is not included in the standard SDK's (such as ViewPager and SlidingDrawer)

Kuffs
  • 35,581
  • 10
  • 79
  • 92
3

From the looks of it, the ONLY DrawerLayout implementation comes from the SupportLib (ie. there is not another source of this code).

Also, from the looks of it, it was introduced in API 19, so your API 14 min wouldn't be adequate anyway.

Bottom line, you should just include the SupportLibrary, and move on with your life, there is no significant issue including this library, and it will be much more work to try and create a workaround.

Booger
  • 18,579
  • 7
  • 55
  • 72
2

You can either extract it from the support library v4 source code or use 3rd party library like SlidingMenu

There once was an alternative/official implementation called SlidingDrawer, however it is deprecated since API Level 17.

This is not hard to understand, there are many fancy features which is not contained in the official SDK release. Just go for what you want and don't pay too much attention to where it is from.

Robin
  • 10,052
  • 6
  • 31
  • 52
  • Are you saying that the new API provide less feature than the older one + Support fragments, and that there isn't any standard way of doing that without extracting/using support library or external library? – Pierre-Jean Mar 10 '14 at 13:54
  • See my edited answer. Don't be too sensitive to the purity of your code. – Robin Mar 10 '14 at 13:59