By Using DrawerLayout (by using android.support.v4.widget.DrawerLayout)from Android support library, we are achieving the navigation drawer functionality in our Android app.
But this is the ONLY thing an app needs from android.support.v4.
Is there a way or a roadmap in future exist, where DrawerLayout becomes part of android.jar(like Fragment who migrated from support-library now into android.jar)?
This way developers are not required to add a library(android.support.v4) just for using 1 widget/class from it!
Also, Currently, is there a way to continue using DrawerLayout without a need to add android.support.v4? App does not have a requirement to use other Navigation patterns like Toolbar or ViewPager.
With a large amount of functionality being unique to support-v4, most of the components in that library will remain there long term as it allows continual bug fixes and evolving of those components to meet the latest design and functionality specs without leaving broken versions in older versions of the framework. If you are using ProGuard (either directly or via the gradle minifyEnabled line), parts of the support library you are not using will be completely stripped from your application.
Of course, you can certainly extract DrawerLayout from the library and embed it in your application: the source is readily available if you find it necessary.
Related
I am very new to Android Development, but can I ask why the FAB is not supported in Activity and only in AppCompactActivity. Correct me if I am wrong but it's my understanding that as long as you are not bothered with backwards compatibility then using Activity is the one to use as you can directly implement material themes and use the latest material design like CardViews RecyclerViews and other layouts like CoordinatorLayout. Why then when you want to use a material design feature like the FAB does it force you to use the AppCompactActivity, I thought using the one supporting higher APIs would work. Am I missing something here, I know there are third party libs I can use, but I really need to get my head around this...
FloatingActionButton is not a part of core android library. Rather it is a part of android support design library.
compile "com.android.support:design:27.0.2"
This means this class is not pre-installed in android devices. Also to use it, your activity must use one of the AppCompat themes. Hence you need to use appcompat library to use a default FAB.
compile "com.android.support:appcompat-v7:27.0.2"
However, you can find many open source third party libraries for FAB in GitHub.
I'm studying about the layout types in Android and I started construct a floating button and I would like to know what is the best mode to create a floating button in Android Studio. Using floatingActionButton library at Android Studio or creating without libraries.
I advise you to use the support one when it answers your needs (or at least start with it until you see a major drawback).
Most of time, if the support library covers your needs, you'll be less likely to have bugs or issues with it than you would with a third party library.
I'd like to add a sliding drawer to my app which is using the min sdk version of 16 and a target sdk of 21 and should allow it to use the most recent features of the platform.
I looked around on how to implement a sliding drawer, and all the articles I found talk about using some support APIs to do just that.
My app is not yet using these support APIs.
I wonder if implementing the sliding drawer is possible without any support APIs, and if so, if there is any resources showing just that.
DrawerLayout, the basis for Creating a Navigation Drawer is only found in the Android Support Library (along with many other Support Library only APIs). There is nothing in the Android framework that provides this same functionality.
To provide the most consistent experience to users, you should just use the Support Library.
You should consider using support APIs, but if you really dont want to, you can use user-created library.
Here's one I used for one of my projects:
https://github.com/mikepenz/MaterialDrawer
Yes, it is always possible. However, the DrawerLayout class is available only in support libraries.
When I first realized that, it made no sense to me. But now I see support libraries as an extension of the core libraries (android.*).
Anyway, I recommend using the support libraries or you will have to create the logic to do exactly the same from scratch.
You can use android design support library, it's working on all devices in android and it's open source so you can edit it as you like with custom element.
Here's a reference how to implement Navigation drawer using new android support library
I have an Android library that helps implement and add various GUI components the Android navigation drawer.
Currently the library will only support the full APIs from the supported API, i.e. from Honeycomb onwards.
I want to change the library so it can also work with AppCompat, that shouldn't be a problem as it is likely to always to be installed and available.
The problem I have, a couple of users who use the library have requested that my library can support the use of the ActionBarSherlock library as well.
I don't want to do to separate navigation drawer management libraryies, and app compat and then a separate library for ActionBarSherlock so what I am wondering is if there is a way I can make a class that uses ActionBarSherlock libraries but will only attempt to compile/use the classes(s) if ActionBarSherlock is available.
Therefore the user can use my one library and be able to use all 3 different types of navigation drawer without needing multiple different libraries to support them.
My library is used within Android Studio not Eclipse
Right now I'm using the ViewPagerIndicator for swipe-able fragments with an indicator in my program and it's working like a charm. But since Google is pushing more and more into the direction of Fragments without using the Android support library and e.g. PreferenceFragments aren't available in the support library, I'm wondering if there is something similar to the ViewPagerIndicator that's using the standard Android library.
Google is pushing more and more into the direction of Fragments without using the Android support library
And your proof of this is... what, exactly?
e.g. PreferenceFragments aren't available in the support library
It is not possible to backport PreferenceFragment very easily, as there are many other requirements to make that useful (e.g., backporting the new PreferenceActvity). I have personally looked into backporting the preference fragment system and concluded that it would be significantly more pain than it is worth to me.
I'm wondering if there is something similar to the ViewPageIndicator that's using the standard Android library
By definition, that is impossible, as ViewPager is in the Android Support package, which means any indicator for ViewPager must use the Android Support package.
However, there is nothing about ViewPager that requires you to use fragments. You are welcome to create your own PagerAdapter implementation that does not use any fragments, or uses native API Level 11 fragments, if you so choose.