This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** | |
* <pre> | |
* author : jarylan | |
* e-mail : [email protected] | |
* time : 2017/04/24 | |
* desc : 调节 ViewPager 滑动速度; | |
* version: 1.0 | |
* </pre> | |
* | |
* 使用示例 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mPath = new Path(); | |
mPath.moveTo(POINT0[0], POINT0[1]); | |
mPath.lineTo(POINT1[0], POINT1[1]); | |
mPath.cubicTo(POINT1[0], POINT1[1], POINT2[0], POINT2[1],POINT3[0], POINT3[1]);//贝塞尔曲线 | |
mPath.lineTo(POINT4[0], POINT4[1]); | |
mPath.cubicTo(POINT4[0], POINT4[1], POINT5[0], POINT5[1],POINT6[0], POINT6[1]); | |
mPathMeasure = new PathMeasure(mPath, true);//true 执行一次 | |
mCurrentPosition = setPoint((float)POINT0[0],(float)POINT0[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** | |
###一 . 利用SpannableStringBuilder或 SpannableStrin 类来实现; | |
SpannableStringBuilder ss=new SpannableStringBuilder("啦啦啦,我是卖报的小当家!"); | |
// 替换 某个字段的字体样式 | |
//设置字体(default,default-bold,monospace,serif,sans-serif) | |
1.使用默认 | |
msp.setSpan(new TypefaceSpan("serif")), 2,4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | |
2.使用资源文件下 | |
msp.setSpan(new CustomTypefaceSpan("",Typeface.createFromAsset(this.getAssets(),"font/FZY3JW.TTF")), 2,4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
以下为部分XML标志符的数字和字符串转义符: | |
“ 双引号 (" 或 ") | |
’ 单引号 (' 或 ') | |
& and符号 (& 或 &) | |
< 小于号 (< 或 <) | |
> 大于号 (> 或 >) | |
@ at符号 (@) | |
© 版权 (©或 ©) | |
® 注册商标 (®或 ®) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android:clipChildren的意思:是否限制子View在其范围内 | |
android:clipToPadding就是说控件的绘制区域是否在padding里面的 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question: | |
在Android软件设计与实现中我们通常都会使用到ListView这个控件,系统有一些预置的Adapter可以使用,例如SimpleAdapter和ArrayAdapter,但是总是会有 | |
一些情况我们需要通过自定义ListView来实现一些效果,那么在这个时候,我们通常会碰到自定义ListView无法选中整个ListViewItem的情况,也就是无法响应 | |
ListView的onItemClickListener中的onItemClick()方法 | |
Solution: | |
可以通过对Item Layout的根控件设置其android:descendantFocusability=”blocksDescendants” , 这样Item Layout就屏蔽了所有子控件获取Focus的权限 | |
注意:这个属性不能设置给ListView,设置了也不起作用 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** | |
保留小数后几位 | |
int point = 1;// 保留位数 | |
float d2 = new BigDecimal(22.395).setScale(point, BigDecimal.ROUND_HALF_UP).floatValue(); | |
BigDecimal.ROUND_CEILING 向上取 直接丢去入一位 | |
BigDecimal.ROUND_FLOOR 向下取 直接丢去 | |
BigDecimal.ROUND_HALF_UP 四舍五入 | |
java.math.Math类常用的常量和方法: |