drawable如何只让两个叫圆角_drawable,andrid 圆形图片,圆角图片

6538896.html

各种drawable 小的例子,

开源中国地址:https://git.oschina.net/lyxs916/drawable-test.git

661957ced957a85f41cdee942da465f9.gif

d6780c112ea1ff436604831c9f704e38.png

bitmap

bitmap xmlns:android="http://schemas.android.com/apk/res/android"

android:antialias="false"

android:dither="true"

android:src="@mipmap/ic_launcher"

android:tileMode="mirror"

bitmap

6538896.html

9a1e653c94e5e03124a675ef1aadf295.png

clip

clip xmlns:android="http://schemas.android.com/apk/res/android"

android:clipOrientation="horizontal"

android:drawable="@mipmap/y"

clip

6538896.html

inset

inset xmlns:android="http://schemas.android.com/apk/res/android"

android:drawable="@color/colorAccent"

android:inset="20dp"

inset

6538896.html

layer-list

layer-list xmlns:android="http://schemas.android.com/apk/res/android"item

android:width="150dp"

android:height="150dp"bitmap android:src="@mipmap/a" item

item

android:width="80dp"

android:height="80dp"

android:left="30dp"

android:top="50dp"bitmap android:src="@mipmap/y" item

item

android:width="50dp"

android:height="50dp"

android:left="40dp"

android:top="60dp"bitmap android:src="@mipmap/a" item

layer-list

6538896.html

level-list

level-list xmlns:android="http://schemas.android.com/apk/res/android"

item

android:drawable="@mipmap/a"

android:maxLevel="10"

android:minLevel="5"

item

android:drawable="@mipmap/y"

android:maxLevel="15"

android:minLevel="11"

item

android:drawable="@mipmap/ic_launcher"

android:maxLevel="4"

android:minLevel="0" level-list

6538896.html

selector

selector xmlns:android="http://schemas.android.com/apk/res/android"

item android:drawable="@mipmap/a" android:state_focused="true"

item android:drawable="@mipmap/y" android:state_selected="true"

item android:drawable="@mipmap/g" android:state_pressed="true"

item android:drawable="@mipmap/ic_launcher" selector

6538896.html

transition

transition xmlns:android="http://schemas.android.com/apk/res/android"item android:drawable="@mipmap/a" item android:drawable="@mipmap/y" transition

6538896.html

/**

* 类说明:绘制圆形的drawable

* Created by 阳 2017/3/12 17:00

*/

public class extends private mPaintprivate mBitmapprivate int mWidth

public thismBitmap mPaint new //着色器

new mBitmapCLAMPCLAMPmPainttruemPaintmWidth minmBitmapmBitmap

@Override

public void

mWidth 2mWidth 2mWidth 2mPaint

@Override

public void int //设置画笔的透明度

mPaint

@Override

public void //设置颜色

mPaint

@Override

public int //设置不透明度

return TRANSLUCENT

@Override

public int //返回drawable实际宽

return mWidth

@Override

public int //返回drawable实际高

return mWidth

6538896.html

20a7fcade5002ad0ecdcc5abb42c8cf0.png

/**

* 类说明:绘制圆角的drawable

* Created by 阳 2017/3/12 17:00

*/

public class extends private mPaintprivate mBitmapprivate mRectFprivate int mRound

/**

* @param bitmap 位图

* @param round 圆角的值

*/

public int thismBitmap mPaint new //着色器

new mBitmapCLAMPCLAMPmPainttruemPaintmRound abs

@Override

public void mRectFmRoundmRoundmPaint

@Override

public void int int int int mRectF new

@Override

public void int //设置画笔的透明度

mPaint

@Override

public void //设置颜色

mPaint

@Override

public int //设置不透明度

return TRANSLUCENT

@Override

public int //返回 图片 实际宽

return mBitmap

@Override

public int //返回 图片 实际高

return mBitmap

6538896.html

f3d92e15036827bbb40a420312d44705.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值