来自com.google.android.material的CardView和android.support.v7.widget有什么区别 [英] What's the difference between the CardView from com.google.android.material and android.support.v7.widget

查看:117
本文介绍了来自com.google.android.material的CardView和android.support.v7.widget有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用Android Studio IDE组件选项板添加的两个小部件android.support.v7.widget.CardView和在Material Design文档中使用的com.google.android.material.card.MaterialCardView之间的区别.

I'd like to know the difference between both widgets android.support.v7.widget.CardView which is added using Android Studio IDE components palette and com.google.android.material.card.MaterialCardView which is used on Material Design documentation.

这两个库是否包含相同的小部件?我应该使用哪一个,以及如何做出此决定?

Are they two libraries that contains the same widget? Which one should I use and how to take this decision?

我尝试阅读更多有关developers.android的文档,但developer.android上的文档确实很大,有很多版本,但我有些困惑,无法在所有这些版本之间找到很好的解释,这一切的历史以及如何到达那里.有人愿意为我提供有关此历史的见解吗?

I tried to read more the developers.android documentation, but the docs on developer.android are really big with many version and I'm yet a bit confused and couldn't find a good explanation between all of these versions, the history of it all and how it got there. Does someone feel happy to gives me a insight about this history?

材料设计文档的用法:

<com.google.android.material.card.MaterialCardView
    android:layout_width="match_parent"
   android:layout_height="wrap_content">
</com.google.android.material.card.MaterialCardView>

来源: https://material.io/develop/android/组件/material-card-view/

使用Android Studio时添加的CardView XML:

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</android.support.v7.widget.CardView>

推荐答案

最近几天,我对Android库的历史进行了研究,得出了我想分享的结论:

I made a research in the last days about the history of Android libraries and I've got a conclusion that I'd like to share:

  1. 组件android.support.v7.widget.CardView是旧库的一部分,建议将其替换为 com.google.android.material.card.MaterialCardView
  2. Android支持库(android.support.*)是一个旧的库,在2018年被新的Android X库(属于Jetpack库的一部分)和材质组件android
  3. 取代了.
  1. The component android.support.v7.widget.CardView is part of an old library and it's recommended to be replaced with com.google.android.material.card.MaterialCardView
  2. Android support library (android.support.*) is an old library that was replace by the new Android X Library in 2018 (which is part of Jetpack Library) and also by material components android

参考:

https://medium.com/@ neerajmoudgil/升级到新的android-material-design-components-e62ddb03c3d2

https://developer.android.com/reference (很大,但是值得寻找想要了解Android库历史以及所有Android版本的初学者.

https://developer.android.com/reference (It's big, but worth to take a look for beginners who would like to understand the history of Android Libraries and also about all of the Android Versions)

这篇关于来自com.google.android.material的CardView和android.support.v7.widget有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆