Android: Can I use the Design Support Library instead of AppCompat for the Material Design Interface?

I think I may have misunderstood the documentation on the web, but there are many examples of implementing Material Design for Android Apps using the Android Design Support Library.

I have an app with a minimum SDK of 14, which I am fine up to 16. I am not using the coordinator composer or whatever, but have the following dependencies for the Material Design theme and Snackbar.

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'

      

I was wondering if I could remove the AppCompat dependency and instead just use the Design Support Library to implement the Material Design theme, but I can't find how to get it. Or did I get it wrong?

+3


source to share


2 answers


You can omit the dependency appcompat

as it design

has a dependency on it. To make sure you can use gradle dependency tree. This is what it looks like. I usecom.android.support:design:24.2.1

+--- com.android.support:design:24.2.1
|    +--- com.android.support:support-v4:24.2.1
|    |    +--- com.android.support:support-compat:24.2.1
|    |    |    \--- com.android.support:support-annotations:24.2.1
|    |    +--- com.android.support:support-media-compat:24.2.1
|    |    |    \--- com.android.support:support-compat:24.2.1 (*)
|    |    +--- com.android.support:support-core-utils:24.2.1
|    |    |    \--- com.android.support:support-compat:24.2.1 (*)
|    |    +--- com.android.support:support-core-ui:24.2.1
|    |    |    \--- com.android.support:support-compat:24.2.1 (*)
|    |    \--- com.android.support:support-fragment:24.2.1
|    |         +--- com.android.support:support-compat:24.2.1 (*)
|    |         +--- com.android.support:support-media-compat:24.2.1 (*)
|    |         +--- com.android.support:support-core-ui:24.2.1 (*)
|    |         \--- com.android.support:support-core-utils:24.2.1 (*)
|    +--- com.android.support:appcompat-v7:24.2.1
|    |    +--- com.android.support:support-v4:24.2.1 (*)
|    |    +--- com.android.support:support-vector-drawable:24.2.1
|    |    |    \--- com.android.support:support-compat:24.2.1 (*)
|    |    \--- com.android.support:animated-vector-drawable:24.2.1
|    |         \--- com.android.support:support-vector-drawable:24.2.1 (*)
|    \--- com.android.support:recyclerview-v7:24.2.1
|         +--- com.android.support:support-annotations:24.2.1
|         +--- com.android.support:support-compat:24.2.1 (*)
|         \--- com.android.support:support-core-ui:24.2.1 (*)

      

Use it yourself



Gradle (top right tab) -> Run gradle Task (gradle) -> make sure you are in -> :app

runapp:dependencies

So it com.android.support:design:25.3.1

will have com.android.support:appcompat-v7:25.3.1

as a dependency.

0


source


It is preferable to use AppCompat as it will adapt everything on older Android versions. And it also depends on what views you are going to use: if this is a regular button or edit text, it is better to use the standard one. as all android versions support them.



0


source







All Articles