android 日期时间格式转换;软键盘显示消失;获取系统title
2011-01-26 10:52
1066 查看
获取activty title bar:
TextView actionTitle = (TextView) findViewById(com.android.internal.R.id.action_bar_title);
View actionTitle = getWindow().getDecorView().findViewById(getResources().getIdentifier("android:id/action_bar_title", null, null));
将系统当前事件,转化为所需格式:
在源码短信息模块中MessageUtils.java中有这样一个函数,与上面的功能相同:
或者
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
或者
TextView actionTitle = (TextView) findViewById(com.android.internal.R.id.action_bar_title);
View actionTitle = getWindow().getDecorView().findViewById(getResources().getIdentifier("android:id/action_bar_title", null, null));
private final static String M12 = "h:mm"; private final static String M24 = "kk:mm"; formatTime = android.text.format.DateFormat.is24HourFormat(context)? M24 : M12; String timeStr = (String) DateFormat.format(formatTime,System.currentTimeMillis());
将系统当前事件,转化为所需格式:
private String getDate(long dateTime) { int flags = 0; String date = ""; if (DateUtils.isToday(dateTime)) { flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR; date = (String)DateUtils.formatDateTime(mContext, dateTime, flags); } else { flags = DateUtils.FORMAT_SHOW_DATE; date = (String)DateUtils.formatDateTime(mContext, dateTime, flags); } return date; }
在源码短信息模块中MessageUtils.java中有这样一个函数,与上面的功能相同:
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); View view = getCurrentFocus(); if (view != null){ // imm.showSoftInput(view, 0); //显示软键盘 imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); // imm.hideSoftInputFromWindow(view.getWindowToken(), 0);//隐藏软键盘 // InputMethodManager.HIDE_NOT_ALWAYS); }
或者
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
或者
public void showInputMethod() { InputMethodManager imm = getInputMethodManager(); if (imm != null) { imm.showSoftInput(this, 0); } }
相关文章推荐
- android 日期时间格式转换;软键盘显示消失;获取系统title
- android 中 系统日期时间的获取和日期的转换
- iOS 获取系统时间以及时间与日期格式互相转换
- Android 获取当前系统时间 时间之间的转换 判断字符串是否日日期类型
- android 日期格式处理 ,获取当前系统时间并设置格式为--年--月--日
- Android:获取当前系统时间生成日期格式
- JAVA,jsp,oracle获取系统当前时间以及日期格式转换!
- android 字符串工具类 格式化日期字符串 拼接数组 判断字符串是否为空 转换时间显示 转换文件大小 获取中英文字符个数
- jquery 时间戳转成日期格式 , 后台返回时间格式(后台没有进行时间格式转换) ,前端转换成日期格式显示。
- 项目中在Android.mk文件中根据项目名称选择不同的AndroidManifest.xml文件 && 如何使用系统设定的日期显示格式
- java 日期的格式化、解析、数据库相关操作、获取系统时间、String与Date的转换
- 前台js获取到后台json数据,eval解析json后,日期(object)对象转换为date日期格式显示
- android 中 系统日期时间的获取
- mysql获取日期(将时间戳转换成短日期格式)
- android 中 系统日期时间的获取
- Android系统时间制式的获取(24钟头制式/12小时制式)及UTC与本地时间的转换
- android 中 系统日期时间的获取
- Android获取当前系统日期和时间
- 获取系统时间函数及时间格式的转换
- j2me中获取系统时间并转换成字符串格式