摘要: 在自定义ViewGroup中,很多效果都包含用户手指去拖动其内部的某个View(eg:侧滑菜单等),针对具体的需要去写好onInterceptTouchEvent和onTouchEvent这两个方法是一件很不容易的事,需要自己去处理:多手指的处理、加速度检测等等。 好在官方在v4... 阅读全文
posted @ 2016-05-14 21:16 RicardoMJiang 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 概述在写代码之前,我必须得问几个问题: 1、ViewGroup的职责是啥?ViewGroup相当于一个放置View的容器,并且我们在写布局xml的时候,会告诉容器(凡是以layout为开头的属性,都是为用于告诉容器的),我们的宽度(layout_width)、高度(layout_h... 阅读全文
posted @ 2016-05-14 17:05 RicardoMJiang 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 有时候 ,为了满足一些需求,我们要用到 shape 去定义 一些背景,shape 的用法 跟图片一样 ,可以给View设置 Android:background=”@drawable/shape”, 定义的shape 文件,放在 res/shape 目录下通常我们可以用shape ... 阅读全文
posted @ 2016-05-14 15:09 RicardoMJiang 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 首先说一下canvas类:Class OverviewThe Canvas class holds the "draw" calls. To draw something, you need 4 basic components: A Bitmap to hold the pixe... 阅读全文
posted @ 2016-05-14 10:57 RicardoMJiang 阅读(282) 评论(0) 推荐(0) 编辑