使用MaterialCardView和使用cardElevation
将其添加到 gradle 文件中以供使用material components
implementation 'com.google.android.material:material:1.2.0-alpha03'
Run Code Online (Sandbox Code Playgroud)
样式.xml
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在你的xml中
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:strokeWidth="1dp"
app:strokeColor="@color/stroke_color"
app:cardElevation="10dp"
android:layout_margin="8dp">
//add some view
</com.google.android.material.card.MaterialCardView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4192 次 |
| 最近记录: |