CardCiew卡片式布局使用方法

卡片式布局使用起来非常简单,首先在bulid.gradle文件中加入这么一句话compile 'com.android.support:cardview-v7:21.+',

然后就可以当做是其他控件来在你的xml文件中配置使用了

强调一点,一定是support.v7包下的cardview


案例如下

 <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="300dp"
        android:layout_height="450dp"
        card_view:cardBackgroundColor="#ffffff"
        card_view:cardCornerRadius="25dp"
        card_view:cardPreventCornerOverlap="true"
        android:elevation="20dp"
        card_view:cardUseCompatPadding="true"
        card_view:contentPadding="5dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="20dp"
            android:gravity="center"
            android:orientation="vertical"
            >

    <EditText
        android:layout_above="@+id/feedback"
        android:id="@+id/phone"
        android:layout_width="fill_parent"
        android:layout_height="30dp"
        android:background="@drawable/edittext_background"
        android:hint="请输入您的联系方式"
        android:inputType="phone" />

    <EditText
        android:layout_above="@+id/commit"
        android:layout_marginBottom="25dp"
        android:layout_marginTop="20dp"
        android:gravity="left"
        android:id="@+id/feedback"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/edittext_background"
        android:hint="请输入您的宝贵意见"
        android:padding="10dp"
        android:lines="10"
        />

    <Button
        android:id="@+id/commit"
        style="@style/textSytle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/button"
        android:onClick="commit"
        android:text="提交" />
    </LinearLayout>
    </android.support.v7.widget.CardView>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值