Android Sample NotePad学习三
来源:互联网 发布:新三国知乎 编辑:程序博客网 时间:2024/05/23 13:31
在NotePad中当我们编辑一片日记的时候每次按回车就会出现在下面出现一个横线,学习一下对于以后自定义控件提供一点思路,看一下效果如下:
因为这个控件艾女士继承自TextView的,所以他有TextView的方法,其实这个的原理就是当我们在上面写的时候其实是不停地onDraw()的,然后重写这个方法,然后在上面每一行加了一条横线,
对于getLineCount()的解释
Return the number of lines of text, or 0 if the internal Layout has not been built.
对于getLineBounds(int line,Rect bounds)的解释:
Return the baseline for the specified line (0...getLineCount() - 1) If bounds is not null, return the top, left, right, bottom extents of the specified line in it. If the internal Layout has not been built, return 0 and set bounds to (0, 0, 0, 0)
- Parameters:
- line which line to examine (0..getLineCount() - 1)
- bounds Optional. If not null, it returns the extent of the line
- Returns:
- the Y-coordinate of the baseline
- 可以看出返回的是当前行的左上角的y坐标的值
note_editor.xml
在xml文件中引用自定义的空间,其实就当成TextView就可以只不过每写一行在下面加一个横线
- Android Sample NotePad学习三
- Android Sample NotePad学习一
- Android Sample NotePad学习二
- Android Sample学习——NotePad
- Notepad学习笔记三
- GPhone--Android学习笔记(三):练习(2) Notepad V2
- Android sdk下的sample应用学习
- android doc例程---Notepad Tutorial学习要点!
- android 源码 学习之notepad(不断更新ing)
- Notepad++源码分析(三)
- Android 学习笔记 Service (二) Remote Service Sample
- Android Sample——UI之ActionBarCompat-Basic学习
- 学习Android最适合的方式(官方Sample Code)
- android自带示例notepad学习笔记一
- Sample Framework 学习
- AndEngine 学习sample搭建
- 【计划】Android Sample Codes
- Android导入sample项目
- spring mvc:测试
- 状态机实践入门
- struts2首页跳转后执行action
- Kgdb调试linux kernel module
- java API的学习方法
- Android Sample NotePad学习三
- GNU C 扩展之__attribute__ 机制简介
- Amazon EBS弹性块存储服务初探
- jQuery总体架构的理解
- SMS管理:收信箱 发信息 编写新信息
- 捡起linux ---(1)
- linux module charactor device deamon code.
- 统计指定目录下,指定后缀文件的个数及内容行数
- 2011年3月5日,CSDN博客开张