android银行卡操作步骤
来源:互联网 发布:c语言第四章答案 编辑:程序博客网 时间:2024/04/26 13:24
android银行卡操作步骤
项目介绍:
继承View 实现自定义属性(不知道自定义属性的百度)
public BootStepView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);// 加载自定义属性集合BootStepViewTypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BootStepView);// 解析集合中的属性属性// 将解析的属性传入到画圆的画笔颜色变量当中(本质上是自定义画圆画笔的颜色)// 第二个参数是默认设置颜色(即无指定情况下使用)circularColor = typedArray.getColor(R.styleable.BootStepView_circular_color, Color.RED);circularSize=typedArray.getDimensionPixelSize(R.styleable.BootStepView_circular_size,16);circularTextSize=typedArray.getDimensionPixelSize(R.styleable.BootStepView_circular_text_size,60);circularTextColor= typedArray.getColor(R.styleable.BootStepView_circular_text_color, Color.WHITE);....}
在onMeasure()对View的宽高进行测量
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(widthMeasureSpec, heightMeasureSpec);// 获取宽-测量规则的模式和大小int widthMode = MeasureSpec.getMode(widthMeasureSpec);int widthSize = MeasureSpec.getSize(widthMeasureSpec);// 获取高-测量规则的模式和大小int heightMode = MeasureSpec.getMode(heightMeasureSpec);int heightSize = MeasureSpec.getSize(heightMeasureSpec);int width=480;int height=240;if (widthMode == MeasureSpec.AT_MOST && heightMode == MeasureSpec.AT_MOST) {setMeasuredDimension(width, height);} else if (widthMode == MeasureSpec.AT_MOST ) {setMeasuredDimension(width, heightSize);}else if(heightMode== MeasureSpec.AT_MOST){setMeasuredDimension(widthSize, height);}} ## 在onDraw()实现protected void onDraw(Canvas canvas) {super.onDraw(canvas);// 获取传入的padding值final int paddingLeft = getPaddingLeft();final int paddingRight = getPaddingRight();final int paddingTop = getPaddingTop();final int paddingBottom = getPaddingBottom();int width=getWidth();//开始绘制第一个圆int oneX=paddingLeft+circularSize*2;canvas.drawCircle(oneX,paddingTop,circularSize,paint);//开始绘制数字1paint.setColor(circularTextColor);paint.setTextSize(circularTextSize);canvas.drawText("1",oneX-circularTextSize/3,paddingTop+circularTextSize/3,paint);//开始绘制第一个线条paint.setColor(isTwoColor?circularColor:defaultColor);canvas.drawLine(oneX+circularSize,paddingTop,width/2-circularSize,paddingTop,paint);...}
很简单的一个东西,直接附上项目源码下载地址:
点击下载
阅读全文
0 0
- android银行卡操作步骤
- android 银行卡。。空格输入
- Android 银行卡快捷支付
- android 银行卡四位加空格
- Android银行卡识别
- android 数据库更新操作步骤
- Android EditText 银行卡四位空一格
- pay---Android 银行卡快捷支付
- Android EditText 银行卡四位空一格
- Android EditText 银行卡四位空一格
- Android 银行卡扫描(信用卡),IOS 银行卡扫描(信用卡)
- Android 笔记:识别银行卡,获取银行卡卡号
- android手机扫描银行卡,银行卡号识别SDK
- Unity和android集成操作步骤
- android 想要弹出另外界面操作步骤
- Android蓝牙开发(三):操作步骤
- [Android] PPTP VPN客户端拨号操作步骤
- android添加快捷方式 操作步骤和注意事项
- python 闭包
- CentOS7安装部署PostgresSQL9.6
- ggbiplot-最好看的PCA作图:样品PCA散点+分组椭圆+主成分丰度和相关
- C++ Boost在VS2017中的使用
- C# XML 用法
- android银行卡操作步骤
- Google Architecture Components 使用
- 技术问答整理(10)
- Mysql主从同步
- comet4j中 CometContext.getInstance().getEngine(); 空指针异常
- 每天学习API之五 ,zepto源码contains,inArray, trim,
- hadoop学习记(1)--集群安装部署
- 谈谈到底什么是抽象,以及软件设计的抽象原则
- html表格的css样式