您的位置:首页 > 移动开发 > Android开发

android零碎知识点总结

2016-04-13 16:37 519 查看
1、Android Studio中TextView自动识别超链接属性:

在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();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: