Android Irregular View

About this Project

An android view that enable clip foreground and background into irregular shape

Core Ability

  • foreground drawable
  • background drawable
  • foreground border
  • background border
  • clip drawable into any shape
  • clip by path or round corners

Steps for Integration

1. Dependency
kotlin 复制代码
api("io.github.hellogoogle2000:android-irregular-view:1.0.1")
2. Apply in Xml
xml 复制代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:background="@color/white"
    android:gravity="center"
    android:orientation="vertical">

    <com.android.library.irregularview.IrregularView
        android:id="@+id/irregularView1"
        android:layout_width="150dp"
        android:layout_height="120dp"
        android:background="#2200FF00"
        android:padding="5dp"
        app:foreground="@drawable/ic"
        app:foregroundBorderColor="#FF00FF"
        app:foregroundBorderWidth="5dp"
        app:foregroundOutline="Path"
        app:foregroundPathData="M 0 50 L 0 0 L 100 0 L 100 50 A 50 50 0 0 1 0 50 Z" />

    <com.android.library.irregularview.IrregularView
        android:id="@+id/irregularView2"
        android:layout_width="150dp"
        android:layout_height="120dp"
        android:layout_marginTop="10dp"
        android:background="#2200FF00"
        android:padding="5dp"
        app:foreground="@drawable/ic"
        app:foregroundBorderColor="#FF00FF"
        app:foregroundBorderWidth="5dp"
        app:foregroundBottomRightRadius="20%"
        app:foregroundOutline="RoundRect"
        app:foregroundTopLeftRadius="20%" />

    <com.android.library.irregularview.IrregularView
        android:id="@+id/irregularView3"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_marginTop="10dp"
        app:background="@color/blue_percent_50"
        app:backgroundOutline="Path"
        app:backgroundPathData="M 50 0 A 50 50 0 0 0 50 100 A 50 50 0 0 0 50 0"
        app:foreground="@color/red_percent_50"
        app:foregroundCornerRadius="20%"
        app:foregroundOutline="RoundRect" />
</LinearLayout>
3. Cautions
  • path will be scaled to fill content size
  • round corners is defined in fraction
  • master basic knowledge of path, if you want to accomplish any shape
4. Supported Attributes
  • foreground
  • foregroundOutline
  • foregroundPathData
  • foregroundCornerRadius
  • foregroundTopLeftRadius
  • foregroundTopRightRadius
  • foregroundBottomLeftRadius
  • foregroundBottomRightRadius
  • foregroundBorderColor
  • foregroundBorderWidth
  • background
  • backgroundOutline
  • backgroundPathData
  • backgroundCornerRadius
  • backgroundTopLeftRadius
  • backgroundTopRightRadius
  • backgroundBottomLeftRadius
  • backgroundBottomRightRadius
  • backgroundBorderColor
  • backgroundBorderWidth

Preview

相关推荐
美狐美颜SDK开放平台8 小时前
准备开发直播APP?视频美颜SDK接入前的十项检查清单
android·ios·音视频·直播美颜sdk·视频美颜sdk
传奇开心果编程8 小时前
【Jetpack Compose娓娓道来】第26课:Repository模式与数据层设计——数据的唯一入口
android·移动开发·1024程序员节·jetpack compose·编程语言理论·编程框架·声明式ui
三少爷的鞋12 小时前
Kotlin 协程,重点就在「协」这个字上
android·kotlin
好的佩奇13 小时前
Dart 之模式
android·flutter·dart
淡淡的香烟15 小时前
Flutter实现多语言切换
android·flutter·1024程序员节
AIsoft_868917 小时前
手机视频转文字工具清单:哪些APP支持录屏识别
android·音视频
_祝你今天愉快19 小时前
Paint Cavans高级绘制:[一]Paint画笔高级应用
android
@zulnger20 小时前
安卓进行稳定性测试
android·appium·1024程序员节
不吃凉粉21 小时前
android 副屏连接
android
OxYGC1 天前
手机为什么能“自动跳过“开屏广告?李跳跳、GKD 与 iOS 代理软件原理盘点
android·ios·开屏广告·广告屏蔽