随笔分类 -  Android

1 2 3 4 5 ··· 7 下一页
摘要:取消alarm使用AlarmManager.cancel()函数,传入参数是个PendingIntent实例。该函数会将所有跟这个PendingIntent相同的Alarm全部取消,怎么判断两者是否相同,android使用的是intent.filterEquals(),具体就是判断两个Pending... 阅读全文
posted @ 2014-06-15 11:30 无忧之路 阅读(6564) 评论(0) 推荐(0) 编辑
摘要:使用ImageButton的background属性,而不用src属性。然后使用width和height进行调整。 阅读全文
posted @ 2014-06-14 15:29 无忧之路 阅读(1704) 评论(0) 推荐(0) 编辑
摘要:在listView的item里面如果有button,ImageButton等控件,会使得ListView不会被点击,解决方法是:①在Button上面添加属性android:focusable="false"②在包含Button的布局管理器上面添加android:descendantFocusabil... 阅读全文
posted @ 2014-06-14 15:21 无忧之路 阅读(445) 评论(0) 推荐(0) 编辑
摘要:界面中有一个按钮使用这样的样式:会发现按钮被点击之后颜色未变,原来是press="true"的位置颠倒了,改为如下即可:也就是两个Item标签更换一下位置。特殊情况应放在前面,也就是android:state_pressed="true",这一块应该放在前面。 阅读全文
posted @ 2014-06-14 12:07 无忧之路 阅读(7296) 评论(0) 推荐(0) 编辑
摘要:在cmd命令行下,进入platform-tools目录下。1.创建sdcardmksdcard -l mycard 256M E:\android\myCards\mysdcard.img这样就在该目录下创建好了一个SD卡的虚拟镜像。其中-l命令行参数表示虚拟磁盘的卷标号。256M是创建的虚拟sdc... 阅读全文
posted @ 2014-06-13 21:05 无忧之路 阅读(816) 评论(0) 推荐(0) 编辑
摘要:在4.0之后在主线程里面执行Http请求都会报这个错,大概是怕Http请求时间太长造成程序假死的情况吧。解决办法有两个思路,分别是:第一种方法:直接忽视,强制使用(强烈不推荐,但是修改简单) 在MainActivity文件的setContentView(R.layout.activity_main)... 阅读全文
posted @ 2014-06-08 20:28 无忧之路 阅读(3979) 评论(0) 推荐(0) 编辑
摘要:绑定服务: 用于间接调用服务里面的方法。如果调用者Activity被销毁了,服务也跟着销毁了,服务也会跟着销毁。开启服务: 不可以调用服务里面的方法。如果调用者的Activity退出了,服务还会长期在后台运行生命周期 ①单独调用 startService() - onCreate, stopS... 阅读全文
posted @ 2014-05-17 11:39 无忧之路 阅读(184) 评论(0) 推荐(0) 编辑
摘要:界面: Activitypackage com.example.serviceTest;import android.app.Activity;import android.content.ComponentName;import android.content... 阅读全文
posted @ 2014-05-17 11:26 无忧之路 阅读(787) 评论(0) 推荐(0) 编辑
摘要:package com.example.HyyRecord;import android.app.Activity;import android.content.Intent;import android.media.MediaRecorder;import android.net.Uri;impo... 阅读全文
posted @ 2014-05-17 00:42 无忧之路 阅读(482) 评论(0) 推荐(0) 编辑
摘要:super.onDestroy(); 的问题。注意:没有显式地在自己的方法中调用父类Activity的onDestroy是会报错的。我的问题很简单,在我覆盖的onDestroy(),方法中需要调用父类的onDestroy。我就是不懂调用的时机,就像下面两种。protectedvoidonDestro... 阅读全文
posted @ 2014-05-17 00:33 无忧之路 阅读(1248) 评论(0) 推荐(0) 编辑
摘要:Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); inten... 阅读全文
posted @ 2014-05-17 00:10 无忧之路 阅读(399) 评论(0) 推荐(0) 编辑
摘要:item中存在 ImageButton 等可以点击的组件,这会抢先获得ListView的焦点. 从而导致item点击失效 阅读全文
posted @ 2014-05-16 12:38 无忧之路 阅读(210) 评论(0) 推荐(0) 编辑
摘要:开启震动,单次,5秒: Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); //震动5秒 vibrator.vibrate(50... 阅读全文
posted @ 2014-05-12 15:23 无忧之路 阅读(1079) 评论(0) 推荐(0) 编辑
摘要:package com.example.openBackLight;import android.app.Activity;import android.hardware.Camera;import android.os.Bundle;import android.view.View;import ... 阅读全文
posted @ 2014-05-12 14:58 无忧之路 阅读(4588) 评论(0) 推荐(0) 编辑
摘要:调节的关键代码: WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.screenBrightness = Float.parseFloat(brightN... 阅读全文
posted @ 2014-05-12 14:38 无忧之路 阅读(2378) 评论(0) 推荐(0) 编辑
摘要:seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { /** * 拖动中数值的时候 * @param fromUser 是否是由用户操... 阅读全文
posted @ 2014-05-12 01:38 无忧之路 阅读(4458) 评论(0) 推荐(0) 编辑
摘要:本文使用xml来创建上下文菜单 orderInCategory属性为排列顺序MyActivity的布局: MyActivity.javapackage com.example.contextMenuTest;import android.app.Activity;... 阅读全文
posted @ 2014-05-03 11:01 无忧之路 阅读(934) 评论(0) 推荐(0) 编辑
摘要:package com.example.actionBarTest.actionBarList;import android.app.ActionBar;import android.app.Activity;import android.app.Fragment;import android.os... 阅读全文
posted @ 2014-05-02 15:59 无忧之路 阅读(404) 评论(0) 推荐(0) 编辑
摘要:内容可以左右滑动,因为使用了ViewPager(我这里用了V4包)view_pager_main.xml activitypackage com.example.actionBarTest.actionBarTabViewPager;import android.app.ActionBar;impo... 阅读全文
posted @ 2014-05-02 15:50 无忧之路 阅读(562) 评论(0) 推荐(0) 编辑
摘要:actionBar的tab标签应用以及TabListener的方法详解package com.example.actionBarTest.actionBarTab;import android.app.*;import android.os.Bundle;import com.example.act... 阅读全文
posted @ 2014-05-02 15:38 无忧之路 阅读(1393) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 7 下一页
无忧之路
点击右上角即可分享
微信分享提示