设为首页 加入收藏

TOP

自定义控件之 圆形 / 圆角 ImageView(五)
2017-10-12 17:57:46 】 浏览:3534
Tags:定义 控件 圆形 圆角 ImageView
p);
108 canvas.drawARGB(Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color)); 109 return bitmap; 110 } else { 111 return null; 112 } 113 } 114 } View ImageViewPlus.java
 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     xmlns:snser="http://schemas.android.com/apk/res/cc.snser.imageviewplus"
 4     android:layout_width="match_parent"
 5     android:layout_height="match_parent"
 6     android:background="@drawable/wallpaper"
 7     android:orientation="vertical"
 8     tools:context="${relativePackage}.${activityClass}" >
 9     
10     <cc.snser.imageviewplus.ImageViewPlus
11         android:id="@+id/imgplus"
12         android:layout_width="200dp"
13         android:layout_height="300dp"
14         android:layout_marginBottom="50dp"
15         android:layout_centerHorizontal="true"
16         android:layout_alignParentBottom="true"
17         android:src="@drawable/img_rectangle"
18         snser:type="rounded_rect"
19         snser:borderColor="#FF0080FF"
20         snser:borderWidth="10dp"
21         snser:rectRoundRadius="30dp" />
22     
23 </RelativeLayout>
View layout
 1 <?xml version="1.0" encoding="utf-8"?>  
 2 <resources>  
 3     <attr name="type">  
 4         <enum name="none" value="0" />  
 5         <enum name="circle" value="1" />  
 6         <enum name="rounded_rect" value="2" />
 7     </attr>
 8     <attr name="borderColor" format="color" />
 9     <attr name="borderWidth" format="dimension" />
10     <attr name="rectRoundRadius" format="dimension" />
11 
12     <declare-styleable name="ImageViewPlus">  
13         <attr name="type" />
14         <attr name="borderColor" />
15         <attr name="borderWidth" />
16         <attr name="rectRoundRadius" />
17     </declare-styleable>
18 </resources>  
View attrs_imageviewplus.xml

[转载请保留本文地址:http://www.cnblogs.com/snser/p/5159126.html] 

七、Demo源码

保存下面的图片,扩展名改成zip后解压即可。

 

[转载请保留本文地址:http://www.cnblogs.com/snser/p/5159126.html] 

 

 

 

 

首页 上一页 2 3 4 5 下一页 尾页 5/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇【转】Android Studio下加入百度.. 下一篇注册时获取验证码常用的倒计时工具

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目