首页 > 其他分享 >Android Irregular View

Android Irregular View

时间:2024-08-08 12:52:13浏览次数:8  
标签:foreground android Irregular into shape path Android any 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
api("io.github.hellogoogle2000:android-irregular-view:1.0.1")
2. Apply in 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

标签:foreground,android,Irregular,into,shape,path,Android,any,View
From: https://blog.csdn.net/u013718730/article/details/140937493

相关文章

  • Preview of Kola
       What'sApiHugKola-ApiHugKolabackground,whywecreatekola,aboutKolahttps://apihug.com/docs/kola/001_what_is_kolaSummaryKolaisatestingframeworkandtool,primarilyservingtheentireApihugecosystem,andisstillunderactivedev......
  • Android SurfaceFlinger——Vsync信号发送(五十二)
           通过上一篇文章我们创建了一个EventThread线程,并且它持有了 SurfaceFlinger中resyncWithRateLimit()方法的指针。这里我们主要来看一下EventThread对信号的处理。一、发送Vsync信号        当SurfaceFlinger执行完queueBuffer()方法之后,......
  • Android SurfaceFlinger——Fence流转状态(五十)
            明白了fence的基本原理,我们可以进一步的探索整个SurfaceFlinger的中fence在其中处于什么角色。一、流转状态        从启动到屏幕的第一帧的渲染,fence是不会有任何效果的。因为此时fence还没有经过hwc_set给fence进行赋值。但是到了第......
  • 前端实现文档预览(支持word、ppt、pdf)-【@zuiyouliao/vue-file-viewer】
    背景有的时候我们需要在前端页面上预览某些文档,文档的格式比如:word、ppt、pdf、图片等等实现方案可以使用@zuiyouliao/vue-file-viewer第三方库,官方地址方式1:通过组件方式引入优点:word/图片可以识别,方便快捷。缺点:pdf/pptx文件无法识别。安装依赖npminstall--save@zui......
  • Android Qcom USB Driver学习(一)
    该系列文章总目录链接与各部分简介:AndroidQcomUSBDriver学习(零)USB接口类型Android终端上常用的USB接口:TypeC(现在的主流),MicroB(以前的设备)一、TypeCHardwareInterfaceUSB-C引脚和功能指南一文读懂USBTypeC与USB-…TypeC引脚定义USB-C(USBType-C)规范的简单介绍......
  • Android 是如何进行内存管理的
    目录1.垃圾回收(GarbageCollection)2.内存分配3.内存泄漏检测4.内存优化5.内存抖动(MemoryChurn)6.内存警告(MemoryWarning)7.内存分页(MemoryPaging)8.内存分段(MemorySegmentation)9.内存压缩(MemoryCompaction)10.内存分区(MemoryPartitionin......
  • Android Qcom USB Driver学习(零)
    该系列文章总目录链接与各部分简介:AndroidQcomUSBDriver学习(零)文章标题文章链接文章简介AndroidQcomUSBDriver学习(零)https://blog.csdn.net/qq_40405527/article/details/125460598本章主要学习博客各个标题的链接与简介AndroidQcomUSBDriver学习(......
  • Android开发基础06-Android项目结构
    详细介绍Android项目结构Android开发过程中,高效、清晰的项目结构是成功的关键。理解并合理组织项目结构,有助于提高代码的可维护性和团队协作的效率。目录概览一个典型的Android项目目录结构如下:MyApplication/├──app/│├──build/│├──libs/│├......
  • QStyledItemDelegate 和QTreeView实现鼠标hover消息
    1.QTreeView设置属性mousetracking和tablettracing 重写QStyledItemDelegate类,重写函数booleditorEvent(QEvent*event,QAbstractItemModel*model,constQStyleOptionViewItem&option,constQModelIndex&index);这个函数里可以处理鼠标hover和点击事件;boolTreeTas......
  • Java计算机毕业设计基于Android的公交线路状态查询系统(开题报告+源码+论文)
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容研究背景随着城市化进程的加速,公共交通系统成为了城市居民日常出行不可或缺的一部分。然而,传统的公交线路查询方式往往依赖于纸质地图、公交站牌或电话查询,这......