android零碎知识点总结
2016-04-13 16:37
519 查看
1、Android Studio中TextView自动识别超链接属性:
在android studio中TextView支持的一个属性android:autoLink=”“自 动识别超链接,其中的选项有:
web : 网页地址
phone : 电话号码
email : 邮箱地址
all : 所有的超链接
例如自动识别手机号码:
2、日期格式转换:
在开发时,有时候我们从服务器中获取到一个字符串类型的日期数据;但是不是我们想要的日期格式,所以我们需要进行转换:
在android studio中TextView支持的一个属性android:autoLink=”“自 动识别超链接,其中的选项有:
web : 网页地址
phone : 电话号码
email : 邮箱地址
all : 所有的超链接
例如自动识别手机号码:
<TextView android:id="@+id/tv_unload_customer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#8e8e8e" android:textSize="16sp" android:autoLink="phone" android:clickable="true" />
2、日期格式转换:
在开发时,有时候我们从服务器中获取到一个字符串类型的日期数据;但是不是我们想要的日期格式,所以我们需要进行转换:
Date date = null; String endDate = null; try { //定义日期格式 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); //将字符串类型日期转换成Date时间 date = format.parse(datas.getDeliverDate()); //将时间转换成指定格式的日期 endDate = format.format(date); } catch (ParseException e) { e.printStackTrace(); }
相关文章推荐
- Android studio import module Cannot find declaration to go to
- Adb --help
- AndroidManifest versionCode
- android 中PendingIntent 和AlarmManager
- android设计模式之observer
- Android TextView部分文字指定颜色
- Android 带一键删除按钮的EditText
- android 自定义闪退Dialog 收集闪退信息
- android完美解决ClickableSpan中点击后ListView中item的长按冲突的问题
- Android中的MVP设计模式
- Android中显示html标签解决方案
- Android Studio compile project添加一个本地项目依赖包时,提示程序包不存在
- 带滑动菜单的Recyclerview实现
- android中回调机制
- 《Android源码设计模式》读书笔记 (22) 第22章 享元模式
- picasso-强大的Android图片下载缓存库
- Android 创建Library Project(库项目)与引用操作
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android 三目运算符 运用错误
- Android学习笔记-Android与HTML+JS交互