如何定义CardView的边距 [英] How to define margin of CardView

查看:467
本文介绍了如何定义CardView的边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Support CardView的默认边距是多少,以便我可以根据自己的情况定义边距?

What is the default margin of Support CardView so I can define margin for my situation?

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="4dp"
    card_view:cardElevation="2dp">

推荐答案

如何定义CardView的边距?

使用属性android:layout_marginLeftandroid:layout_marginRightandroid:layout_marginTopandroid:layout_marginBottom定义CardView边距.

Use attribute android:layout_marginLeft, android:layout_marginRight, android:layout_marginTop and android:layout_marginBottom to define CardView margins.

Support CardView的默认保证金是多少?

这是CardView 文档.另请参见设计指南.

仅供参考,,使用属性card_view:cardUseCompatPadding="false"删除CardView内部的内部padding.

FYI, Use attribute card_view:cardUseCompatPadding="false" to remove inner padding inside CardView.

这篇关于如何定义CardView的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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