I think I may have misunderstood online documentation, but there are many on implementing Material Design for Android Apps using Android Design Support Library.
I have an app with minimum SDK of 14, that I am ok with increasing to 16. I don't use Coordinator Layout or anything, but have the following dependencies for 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 whether I could remove dependency to AppCompat, and instead just use Design Support Library, to implement the Material Design Theme, but am unable to find how to get this. Or have I understood this incorrectly?
You can ommit the appcompat
dependency since design
has a dependency on it. To verify that you can use the gradle dependency tree. Here it how it looks like. I am using com.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 (*)
To use it yourself
Gradle (top-right-tab) -> Execute Gradle Task (gradle symbol) -> make sure you are in :app
-> run app:dependencies
So com.android.support:design:25.3.1
will have com.android.support:appcompat-v7:25.3.1
as a dependency.
It is better to use AppCompat
, as it will adapt everything in older versions of Android. It also depends on the View
s you are going to use. If it is an ordinary Button
or EditText
, there is no need for AppCompat
, since all Android versions support them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.