With the number of users moving to 7+ android version, is AppCompat still necessary or can I use the new libraries instead. This is specially related to styling. I want to switch to the Material design library for styling. What i'm asking is, is it recommend to use the new Material design library versus AppCompat?
The Material Design Components are built on top of AppCompat, so while you may use Material styles in place of AppCompat, you still need AppCompat under the hood to provide a consistent base across all API levels. This also means you need to continue to extend AppCompatActivity, etc.
Related
So I'm creating an app that is Lollipop 5.0 API 21 and up with zero interest in supporting older devices. Do I still need the appcompat library when using Material Design like UI elements & layouting (sidebar aka nav bar, ink, etc) ? When stripping it down I often encounter crashes when trying to move away from the AppCompat stuff. Changing activity types from the AppCompat one to the Normal one, I end up with problems regarding dependencies on layout types like the coordinator layout that aren't there.
I'm still new to android and this is very confusing, as my theme is currently in limbo somewhere between the appcompat theme & material design when I tried to change it from one of the template.
I've read that this is an android studio issue because it always uses appcompat regardless of your set dependencies & minimum API levels. Forcing you to manually override every implicit hidden appcompat call.
When trying to dump AppCompat, what changes to I need to do to make that happen ? Manifest, Activities, Menus, Layout, Styles ? It seems to touch all these things. If going exclusive without Appcompat, do you still need the v21 folders or will it grab the default ones ?
Do I still need the appcompat library when using Material Design like UI elements & layouting (sidebar aka nav bar, ink, etc) ?
If you are using classes out of the Design Support library, such as NavigationView, you generally need to use appcompat-v7 and AppCompatActivity. As of early May 2016, Google has not shipped a Design Support library analogue that works with Theme.Material. You may be able to find third-party library replacements for some of those widgets, and seasoned Android developers can sometimes "cross-port" these components to eliminate the appcompat-v7 dependencies.
I've read that this is an android studio issue because it always uses appcompat regardless of your set dependencies & minimum API levels. Forcing you to manually override every implicit hidden appcompat call.
The only place that Android Studio really cares about appcompat-v7 is in the new-activity wizards, which you do not have to use.
When trying to dump AppCompat, what changes to I need to do to make that happen ? Manifest, Activities, Menus, Layout, Styles ?
That is difficult to answer in the abstract. You would need to:
Stop using Design Support library widgets and containers
Stop inheriting from AppCompatActivity
Change your app: attributes in your menu resources to their android: equivalents
Change your theme to not use Theme.AppCompat
If going exclusive without Appcompat, do you still need the v21 folders or will it grab the default ones ?
-v21 resource directories are not tied to appcompat-v7. They will still be used, on API Level 21+ devices.
Some material design are only supported starting from android 21 API , so for this purpose we need to provide alternative styles that will work on devices running earlier version . (like they say in documentation ) .
for example :
res/values/styles.xml
res/values-v21/styles.xml
They also have mentioned V7 support library that includes Material design styles .
From here I am little bit confused !
Suppose that my default theme extends from Theme.AppCompat .
Why Should I provide an alternative style for 21 api knowing that Theme.AppCompat is made for compatibility ?
You should do so to use functionalities from api 21 that does not previously exist.
For exemple, on api 21 and later you can make the statusbar translucent, and this is not done by default with the appcompat, because that's not the default behavior.
In a general sense, AppCompat back ports everything that you will generally need to worry about (with new features added all the time). AppCompat itself is doing that alternative style heavy lifting for you.
Start with AppCompat and only create an alternative style if you run in to a specific feature that you need (you probably won't).
I am developing a new Android project with a minimum SDK set at 5.0. I want to use material design, but it seems like many of the material design components are only included in the support library. I really want to theme the app as Material, not AppCompat.
When I try to add a layout from the support library, I get an error every time. What do I need to do to remove the support library dependencies?
The Snackbar is only available in the design support library - it is not baked into versions of Android like EditText/ImageView views.
I want to style all the android.app.ProgressDialogs in my app on pre-Lollipop versions to make them look like Material Design.
Maybe I'm missing something obvious: I'm looking for android.support.v7.app.ProgressDialog, but there is no such class in Android AppCompat library.
Should I write my own implementation of ProgressDialog from scratch? What is the reason it's not included in AppCompat library?
Widget.AppCompat.* styles can be used starting from API 7.
There is currently no AppCompat style for the progress dialog since it relies on AnimatedVectorDrawable.
However, it's possible to write a custom drawable that has the same behavior and apply it to your ProgressDialog.
check out GIT
You can use other cool compatibility libraries besides AppCompat.
There are cool libraries which brings fully animated Material Design components to pre-Lolipop Android on Github. The images are from Rey5137's "Material" library. You better use one of such libraries rather that writing from scratch.
I am new to android and have theming question.
I have project using Toolbar with AppCompat-r21, for api 14+ devices.
Does this mean that only theme i can use is "Theme.AppCompat.Light"?
No Holo, no DeviceDefault ?
Toolbars are a concept only added as part of material design - AppCompat is designed to bring consistent design across all API versions, matching material design guidelines. Therefore if you want to use a Holo theme, you should stick to using the Holo ActionBar and not use Toolbars or AppCompat.
Note that your app will look considerably out of place on newer devices as well as not match any of the Google apps (which all use a material design styling even on older versions of Android).