- 浏览: 3955019 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
hinuliba:
...
字体背景颜色的高度修改 -
KANGOD:
最后的 -createDialog() 私有方法是怎么回事,没 ...
简单的实现listView中item多个控件以及点击事件 -
sswangqiao:
呵呵,呵呵
onActivityResult传值的使用 -
yumeiqiao:
感觉你所的不清楚 lstView.setOnTouchLi ...
listview中viewflipper的问题 -
lizhou828:
果然是大神啊!!!
Animation动画效果的实现
1.当你要旋转一个animition时 你会发现如果你只用rotate 它是不平滑的 旋转360度之后它会滞留一会 然后再转 给人感觉是暂停那么一会 怎么消除呢?这是因为如果只用rotate
它默认使用了android:anim/accelerate_interpolator,所以你要写一个自己的interpolator ,这个interpolator就是linearInterpolator。
所以你必须先建一个res/anim/linear_interpolator.xml:
<?xml version="1.0" encoding="utf-8"?><linearInterpolator xmlns:android="http://schemas.android.com/apk/res/android" />
然后在你的animition中加入
android:iterpolator="@anim/linear_interpolator"这句话就可以了
如:
<?xml version="1.0" encoding="UTF-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:duration="1200" />
默认的是accelerate_interpolator,所以你必须在上面的xml中加入
android:iterpolator="@anim/linear_interpolator"
然后就是平滑的旋转了。
2.当采用过滤的方法:
final TextWatcher textChecker = new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
filterData(search.getText().toString());
}
};
private void filterData(String textinput){
mCursor = mHelperData.searchData(textinput);
startManagingCursor(mCursor);
String[] from = new String[]{ MyData.KEY_ROWID,
MyData.KEY_TITLE, MyData.KEY_DESCRIPTION };
int[] to = new int[]{ R.id.id, R.id.title, R.id.description, R.id.icon };
setListAdapter(new MyAdapter(this, R.layout.list_row, mCursor, from, to ));}
3. 直接发起一个相关的联系人:
Intent intent = new Intent();intent.setAction(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
Intent dialIntent = new Intent( "android.intent.action.DIAL",Uri.parse("tel:666444666")); startActivity(dialIntent);
4.字符串空格以及字符串参数的问题
<string name="Toast_Memory_GameWon_part1">you found ALL PAIRS ! on\ </string><string name="Toast_Memory_GameWon_part2">\ flips !</string>
想在字符串前面和后面有空格一定要注意转义
String message_all_pairs_found = getString(R.string.Toast_Memory_GameWon_part1)+"total_flips"+getString(R.string.Toast_Memory_GameWon_part2);
那么也可以如下实现:
<string name="Toast_Memory_GameWon">you found ALL PAIRS ! on %d flips !</string>
String message_all_pairs_found = String.format(getString(R.string.Toast_Memory_GameWon), total_flips);
5.onKeyDown不起作用 主要因为 可能没有设置setFocusableInTouchMode(true)
最好也加上 setFocusable(true)
6.只知道包名的不知道 R.id的解决办法:
getResources().getIdentifier()
当然你最好吧这个文件放在res/raw/myDataFile 然后读取
7.播放序曲简单方法:
private void playIntro(){ setContentView(R.layout.intro); VideoView video = (VideoView) this.findViewById(R.id.VideoView01); Uri uri = Uri.parse("android.resource://real.app/" + R.raw.intro); video.setVideoURI(uri); video.requestFocus(); video.setOnCompletionListener(this); video.start(); }
8. 用流加载图片
BufferedInputStream buf = new BufferedInputStream(mContext.openFileInput(value));Bitmap bitmap = BitmapFactory.decodeStream(buf);
9.自定义一个dialog
class MyDialog extends AlertDialog {
public MyDialog(Context ctx) {
super(ctx);
LayoutInflater factory = LayoutInflater.from(context);
View view = factory.inflate(R.layout.dialog_layout, null);
setView(view);
setTitle("MyTitle");
setIcon(R.drawable.myicon);
}
}
10. 邮件发送图片
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.setType("jpeg/image");
sendIntent.putExtra(Intent.EXTRA_EMAIL, "me@gmail.com");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "aadjfk");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ sPhotoFileName));
sendIntent.putExtra(Intent.EXTRA_TEXT, sEmailBody);
startActivity(Intent.createChooser(sendIntent, "Email:"));
一定要注意"file://"是两个斜杠
11. 播放视频 htc和其他大部分手机在播放视频时 有些不同
tostart = new Intent(Intent.ACTION_VIEW);
tostart.setDataAndType(Uri.parse(movieurl), "video/*");
startActivity(tostart);
在大部分手机上是
tostart.setClassName("com.android.camera","com.android.camera.MovieView");
而在htc上
tostart.setClassName("com.htc.album","com.htc.album.ViewVideo");
因此你需要判断
private boolean isCallable(Intent intent) {
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
final Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
if (isCallable(intent)) { // call the intent as you intended.}
else { // make alternative arrangements.}
它默认使用了android:anim/accelerate_interpolator,所以你要写一个自己的interpolator ,这个interpolator就是linearInterpolator。
所以你必须先建一个res/anim/linear_interpolator.xml:
<?xml version="1.0" encoding="utf-8"?><linearInterpolator xmlns:android="http://schemas.android.com/apk/res/android" />
然后在你的animition中加入
android:iterpolator="@anim/linear_interpolator"这句话就可以了
如:
<?xml version="1.0" encoding="UTF-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:duration="1200" />
默认的是accelerate_interpolator,所以你必须在上面的xml中加入
android:iterpolator="@anim/linear_interpolator"
然后就是平滑的旋转了。
2.当采用过滤的方法:
final TextWatcher textChecker = new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
filterData(search.getText().toString());
}
};
private void filterData(String textinput){
mCursor = mHelperData.searchData(textinput);
startManagingCursor(mCursor);
String[] from = new String[]{ MyData.KEY_ROWID,
MyData.KEY_TITLE, MyData.KEY_DESCRIPTION };
int[] to = new int[]{ R.id.id, R.id.title, R.id.description, R.id.icon };
setListAdapter(new MyAdapter(this, R.layout.list_row, mCursor, from, to ));}
3. 直接发起一个相关的联系人:
Intent intent = new Intent();intent.setAction(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
Intent dialIntent = new Intent( "android.intent.action.DIAL",Uri.parse("tel:666444666")); startActivity(dialIntent);
4.字符串空格以及字符串参数的问题
<string name="Toast_Memory_GameWon_part1">you found ALL PAIRS ! on\ </string><string name="Toast_Memory_GameWon_part2">\ flips !</string>
想在字符串前面和后面有空格一定要注意转义
String message_all_pairs_found = getString(R.string.Toast_Memory_GameWon_part1)+"total_flips"+getString(R.string.Toast_Memory_GameWon_part2);
那么也可以如下实现:
<string name="Toast_Memory_GameWon">you found ALL PAIRS ! on %d flips !</string>
String message_all_pairs_found = String.format(getString(R.string.Toast_Memory_GameWon), total_flips);
5.onKeyDown不起作用 主要因为 可能没有设置setFocusableInTouchMode(true)
最好也加上 setFocusable(true)
6.只知道包名的不知道 R.id的解决办法:
getResources().getIdentifier()
当然你最好吧这个文件放在res/raw/myDataFile 然后读取
7.播放序曲简单方法:
private void playIntro(){ setContentView(R.layout.intro); VideoView video = (VideoView) this.findViewById(R.id.VideoView01); Uri uri = Uri.parse("android.resource://real.app/" + R.raw.intro); video.setVideoURI(uri); video.requestFocus(); video.setOnCompletionListener(this); video.start(); }
8. 用流加载图片
BufferedInputStream buf = new BufferedInputStream(mContext.openFileInput(value));Bitmap bitmap = BitmapFactory.decodeStream(buf);
9.自定义一个dialog
class MyDialog extends AlertDialog {
public MyDialog(Context ctx) {
super(ctx);
LayoutInflater factory = LayoutInflater.from(context);
View view = factory.inflate(R.layout.dialog_layout, null);
setView(view);
setTitle("MyTitle");
setIcon(R.drawable.myicon);
}
}
10. 邮件发送图片
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.setType("jpeg/image");
sendIntent.putExtra(Intent.EXTRA_EMAIL, "me@gmail.com");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "aadjfk");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ sPhotoFileName));
sendIntent.putExtra(Intent.EXTRA_TEXT, sEmailBody);
startActivity(Intent.createChooser(sendIntent, "Email:"));
一定要注意"file://"是两个斜杠
11. 播放视频 htc和其他大部分手机在播放视频时 有些不同
tostart = new Intent(Intent.ACTION_VIEW);
tostart.setDataAndType(Uri.parse(movieurl), "video/*");
startActivity(tostart);
在大部分手机上是
tostart.setClassName("com.android.camera","com.android.camera.MovieView");
而在htc上
tostart.setClassName("com.htc.album","com.htc.album.ViewVideo");
因此你需要判断
private boolean isCallable(Intent intent) {
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
final Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
if (isCallable(intent)) { // call the intent as you intended.}
else { // make alternative arrangements.}
发表评论
-
URI 转path
2019-06-26 10:41 1344转自知乎Matisse package com.zhihu ... -
权限申请
2017-09-22 13:25 1275public class PermissionActivit ... -
onPreviewFrame 相机输出格式转换yuv420p保存成图片
2015-11-25 15:59 7609在最近项目中,因为特殊需要,底层相机往外输出了i420 也 ... -
new Android's Runtime Permission
2015-11-03 21:05 1252targetSdkVersion 23 开始 使用运行时权 ... -
自定义listview 边缘效果
2015-02-28 10:58 1755static void ChangeEdgeEffect( ... -
发射打开wifi
2015-01-07 10:25 1453WifiManager wifiManager = (Wif ... -
RecyclerView
2014-11-05 13:08 1293http://www.grokkingandroid.com ... -
获取点击区域
2014-04-28 09:39 1594@Override public void getHitR ... -
speex 和libogg 编译
2014-04-03 16:17 6416下载: http://www.speex.org/down ... -
rsync 同步
2014-03-28 17:06 1847两台android 设备 进行rsy ... -
流转字符串
2014-03-11 09:49 1563public static String convertSt ... -
java simplexml 序列化
2014-03-06 13:22 5990<?xml version="1.0&quo ... -
获取其他程序的特定资源
2014-03-05 09:33 1702try { PackageManager man ... -
检测来电属于哪个sim卡
2014-02-07 10:41 1744public class IncomingCallInter ... -
使用 NDK r9 编译ffmpeg
2014-01-16 13:32 168611. 环境 ubuntu 我的是13.10 ndk r9 ... -
android h264含so
2014-01-13 11:24 1561http://download.csdn.net/downlo ... -
xml转义字符
2013-12-18 09:29 1606" " ' & ... -
字体背景颜色的高度修改
2013-12-11 10:31 4243当使用android:lineSpacingExtra= ... -
屏保的实现
2013-12-07 10:27 2832最近需要做一个屏保,开始以为很简单,因为系统本身就带了屏保功 ... -
PreferenceActivity下嵌套PreferenceScreen在其它布局中
2013-11-21 16:32 9190今天在修改系统代码的时候,系统代码用了PreferenceA ...
相关推荐
"Android记事本"就是这样一个应用,它允许用户在手机或平板电脑上轻松记录每天的点滴,无论是工作事项、生活琐碎还是灵感瞬间,都能随时随地保存下来。本文将深入探讨这款应用的功能特性、适用场景以及如何在Android...
途径包括阅读官方文档(如Android training & guide)、看书、体系化学习、写博客和笔记等方式。态度方面,学习者需要有目标、寻找最佳答案,并知其所以然,同时要善于总结。 **实战技能** 实战技能方面,任玉刚...
在现代移动设备上,记事本应用已经成为日常生活中不可或缺的一部分,用于记录琐碎事务、保存灵感或者进行临时性的文字处理。然而,传统的记事本应用往往只提供基本的文字编辑功能,无法满足用户在特定时间提醒的需求...
修炼成Javascript中级程序员必知必会_资源分享
内容概要:本文详细介绍了如何使用MATLAB的深度学习工具箱,在果树病虫害识别任务中从数据准备、模型设计、训练优化到最后的模型评估与应用全流程的具体实施步骤和技术要点。涵盖了MATLAB深度学习工具箱的基本概念及其提供的多种功能组件,如卷积神经网络(CNN)的应用实例。此外,文中还具体讲述了数据集的收集与预处理方法、不同类型的深度学习模型搭建、训练过程中的超参数设定及其优化手段,并提供了病虫害识别的实际案例。最后展望了深度学习技术在未来农业领域的潜在影响力和发展前景。 适合人群:对深度学习及农业应用感兴趣的科研人员、高校师生和相关从业者。 使用场景及目标:①希望掌握MATLAB环境下构建深度学习模型的方法和技术细节;②从事果树病虫害管理研究或实践,寻找高效的自动化解决方案。 阅读建议:在阅读本文之前,建议读者熟悉基本的MATLAB编程环境及初步了解机器学习的相关概念。针对文中涉及的理论和技术难点,可以通过官方文档或其他教程进行补充学习。同时,建议动手实践每一个关键点的内容,在实践中加深理解和掌握技能。
nodejs010-nodejs-block-stream-0.0.7-1.el6.centos.alt.noarch.rpm
机械模型与技术交底书的融合:创新点详解与解析,机械模型加技术交底书,有创新点 ,机械模型; 技术交底书; 创新点,创新机械模型与技术交底书详解
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
nodejs010-nodejs-cmd-shim-1.1.0-4.1.el6.centos.alt.noarch.rpm
西门子四轴卧加后处理系统:828D至840D兼容,四轴联动高效加工解决方案,支持图档处理及试看程序。,西门子四轴卧加后处理,支持828D~840D系统,支持四轴联动,可制制,看清楚联系,可提供图档处理试看程序 ,核心关键词:西门子四轴卧加后处理; 828D~840D系统支持; 四轴联动; 制程; 联系; 图档处理试看程序。,西门子四轴卧加后处理程序,支持多种系统与四轴联动
基于黏菌优化算法(SMA)的改进与复现——融合EO算法更新策略的ESMA项目报告,黏菌优化算法(SMA)复现(融合EO算法改进更新策略)——ESMA。 复现内容包括:改进算法实现、23个基准测试函数、多次实验运行并计算均值标准差等统计量、与SMA对比等。 程序基本上每一步都有注释,非常易懂,代码质量极高,便于新手学习和理解。 ,SMA复现;EO算法改进;算法实现;基准测试函数;实验运行;统计量;SMA对比;程序注释;代码质量;学习理解。,标题:ESMA算法复现:黏菌优化与EO算法融合改进的实证研究
基于MATLAB的Stewart平台并联机器人仿真技术研究与实现:Simscape环境下的虚拟模拟分析与应用,MATLAB并联机器人Stewart平台仿真simscape ,MATLAB; 并联机器人; Stewart平台; 仿真; Simscape; 关键技术。,MATLAB中Stewart平台并联机器人Simscape仿真
Grad-CAM可视化医学3D影像
探索comsol泰勒锥:电流体动力学的微观世界之旅,comsol泰勒锥、电流体动力学 ,comsol泰勒锥; 电流体动力学; 锥形结构; 电场影响,COMSOL泰勒锥与电流体动力学研究
免费JAVA毕业设计 2024成品源码+论文+数据库+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
PFC6.03D模型动态压缩模拟与SHPB霍普金森压杆系统理论及实验数据处理技术解析,PFC6.03D模型,动态压缩模拟,还包括: SHPB霍普金森压杆系统理论知识介绍,二波法和三波法处理实验数据,提出三波波形,计算动态压缩强度等 ,PFC模型; 动态压缩模拟; SHPB霍普金森压杆系统; 理论介绍; 二波法处理; 三波法处理; 三波波形; 动态压缩强度。,"PFC模型下的动态压缩模拟及SHPB理论实践研究"
ProASCI 开发板原理图,适用于A3P3000
免费JAVA毕业设计 2024成品源码+论文+录屏+启动教程 启动教程:https://www.bilibili.com/video/BV1SzbFe7EGZ 项目讲解视频:https://www.bilibili.com/video/BV1Tb421n72S 二次开发教程:https://www.bilibili.com/video/BV18i421i7Dx
1、文件内容:pykde4-devel-4.10.5-6.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/pykde4-devel-4.10.5-6.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装