可挖孔、可圆角、可带分割线的卡片 ViewGroup

Download

使用

implementation 'com.vegen.open:HoleCardView:+'

其中 '+' 请填写版本号 Download 后的最新版本

使用示例

布局

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.vegen.open.library.HoleCardView
        android:layout_width="match_parent"
        android:layout_height="150dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        app:holeElevation="8dp"
        app:holeBackgroundColor="@android:color/white"
        app:holeScallopRadius="10dp"
        app:holeCornerRadius="10dp">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@mipmap/demo"
                android:scaleType="centerCrop"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@android:color/black"
                android:textSize="14dp"
                android:text="可挖孔、可圆角、可带分割线的卡片 ViewGroup"
                android:layout_centerInParent="true"/>
        </RelativeLayout>

    </com.vegen.open.library.HoleCardView>

    <com.vegen.open.library.HoleCardView
        android:layout_width="match_parent"
        android:layout_height="150dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="180dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        app:holeElevation="8dp"
        app:holeBackgroundColor="@android:color/white"
        app:holeScallopRadius="10dp"
        app:holeCornerRadius="10dp"
        app:holeShowDivider="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@android:color/black"
                android:textSize="14dp"
                android:text="可挖孔、可圆角、可带分割线的卡片 ViewGroup"
                />

            <TextView
                android:layout_marginTop="10dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@android:color/black"
                android:textSize="14dp"
                android:text="可挖孔、可圆角、可带分割线的卡片 ViewGroup"
                />
        </LinearLayout>

    </com.vegen.open.library.HoleCardView>

</android.support.constraint.ConstraintLayout>

demo 效果如下
在这里插入图片描述

相关属性

属性名称意义类型默认值
holeOrientation卡片的圆角方向enumhorizontal
holeBackgroundColor卡片颜色colorandroid.R.color.white
holeScallopRadius卡片半圆的半径dimension20dp
holeScallopPositionPercent卡片半圆显示在所在方向的百分比位置float50
holeShowBorder是否显示边框booleanfalse
holeBorderWidth边框宽度dimension2dp
holeBorderColor边框颜色colorandroid.R.color.black
holeShowDivider是否显示分割线booleanfalse
holeDividerWidth分割线的宽度dimension2dp
holeDividerPadding分割线两端的距离dimension10dp
holeDividerColor分割线颜色colorandroid.R.color.darker_gray
holeDividerType分割线模式,normal:直线,dash:间隔分割线,默认enumdash
holeDividerDashGap圆帽大小dimension4dp
holeDividerDashLength分割线的长度dimension8dp
holeCornerType控件的类型,normal:矩形;rounded:圆角矩形,默认;scallop:外向圆角enumrounded
holeCornerRadius圆角半径dimension10dp
android:elevation阴影dimension0f
holeElevation阴影dimension0f

注意:只能有一个直接子布局

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值