Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vivian8725118/CardView
小票形状的CardView,可以修改阴影颜色
https://github.com/vivian8725118/CardView
cardview receipt shadow
Last synced: 3 months ago
JSON representation
小票形状的CardView,可以修改阴影颜色
- Host: GitHub
- URL: https://github.com/vivian8725118/CardView
- Owner: vivian8725118
- Created: 2016-12-01T08:40:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-05T08:10:43.000Z (over 7 years ago)
- Last Synced: 2024-06-16T03:31:47.882Z (5 months ago)
- Topics: cardview, receipt, shadow
- Language: Java
- Homepage:
- Size: 687 KB
- Stars: 504
- Watchers: 11
- Forks: 72
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - CardView - 类似小票效果的卡片列表 (Card)
README
# CardView
类似小票效果的卡片列表,并且可以修改阴影颜色# Usage
可以直接引用CardView
```
CardView cardView=new CardView(context);
//修改CardView的主题颜色
cardView.changeTheme(0xff01a3a1);
```
# 原理
用paint.setShadowLayer来设置阴影颜色和尺寸,进行阴影绘制,用path来画出drawable的形状。
封装了changeTheme的方法,可以直接设置主题的颜色。本示例中为了更好地实现效果,用了```TopDrawable、CenterDrawable、BottomDrawable```三部分拼接而成,也可以用来实现打印小票的视觉效果。另外添加了一个类似FloatingButton效果的```CircleShadowDrawable```。
# 效果图