自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 问答 (1)
  • 收藏
  • 关注

转载 android.os.Process.killProcess(android.os.Process.myPid());重启应用的原理

Process.killProcess 最终是调用 linux API kill() 发送 SIGKILL 信号,进行收到这个信息都会立即结束进程。然而Android 下不同的是 ActivityManager 一直监听者进程状态。如果发现进程被kill,会立即重启进行,并重启之前状态对应的Activity、Service、ContentProvider等。这就是为什么我们调用Proces

2017-01-13 08:44:08 2165

原创 解决scrollview中内容改变后自动滑动到底部的问题

将scrollview包裹的内容设置上以下俩个熟悉android:focusable="true"  android:focusableInTouchMode="true"例如:  <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" an

2016-09-30 16:46:46 6251 4

转载 onActivityResult不执行

1、requestCode值必须要大于等于0,不然,startActivityForResult就变成了 startactivity2、所有需要传递或接收的 Activity 都不能设为launchmode="SingleTask",或者只能设为标准模式,否则系统将在 startActivityForResult() 后直接调用 onActivityResult()。

2016-09-29 14:18:47 443

转载 自定义DatePickerDialog

public class MyDatePickerDialog extends AlertDialog implements DatePicker.OnDateChangedListener { private static final String YEAR = "year"; private static final String MONTH = "month"

2016-08-26 09:29:27 710

转载 重写datepicker实现修改分割线颜色和间隔

public class CustomDatePicker extends DatePicker { private List mPickers; public CustomDatePicker(Context context) { super(context); findNumberPicker(); } public

2016-08-26 09:25:37 1923

原创 android防连点工具类

public class ClickUtils { private static long lastClickTime; public static boolean isFastDoubleClick(){ long time=System.currentTimeMillis(); long timeD=time-lastClickTime;//

2016-08-26 09:18:38 702

转载 Android开发报错 Can't create handler inside thread that has not called Looper.prepare()

原因分析:在线程中调用了Toast(或者Dialog提示)。解决方法:在调用Toast(或者AlertDialog)的地方的前面加上Looper.prepare(),后边加上Looper.loop()即可解决问题;也就是说用Looper.prepare()和Looper.loop()把Toast前后包起来。

2016-08-01 16:11:11 574

原创 android sqlite增删改查语句

增加:db.insert(TABLE_NAME, null, values);删除:db.execSQL("DELETE FROM upload_batch WHERE batch_id = ?", new String[]{batchId});查询:Cursor cursor = db.query(TABLE_NAME, null,"upl

2016-07-30 09:41:12 464

原创 修改PullToRefresh中上拉下拉的图标和文字

下拉上拉 图标和文字 位置改动是在PullToRefresh源代码中改的即:PullToRefreshListView.handleStyledAttributes 中lp的Gravity改为CENTER_VERTICAL如果想要改动图标和文字的距离和布局 在这library项目下这两个文件改pull_to_refresh_header_horizontal.xmlpull

2016-06-27 10:05:49 1946

原创 单击复制textView内容

xml中设置textview的属性android:textIsSelectable="true"例如:<TextView android:id="@+id/tvGongzhonghao" android:layout_width="wrap_content" android:layout_height="wrap_content" android

2016-06-25 17:50:31 592

转载 list去掉重复数据

public static List removeDuplicate(List list){       Set set = new LinkedHashSet();        set.addAll(list);        list.clear();        list.addAll(set);        return list;}

2016-06-22 11:22:05 279

转载 android自动弹出软键盘

很多应用中对于一个界面比如进入搜索界面或者修改信息等等情况,为了用户体验应该自动弹出软键盘而不是让用户主动点击输入框才弹出(因为用户进入该界面必然是为了更改信息)。具体实现这种效果如下: Java代码  EditText  editText.setFocusable(true);     editText.setFocusableInTouchMode(tr

2016-06-20 11:25:46 225

原创 android px和dp之间的转换

public class DensityUtil { /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { final float scale = context.getResources

2016-06-19 11:11:39 290

原创 listview中有checkbox 滑动后状态改变

checkbox设置选中状态代码放到设置监听后面比如:holder.cbChoose.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boo

2016-06-16 16:12:43 364

原创 自定义progressbar颜色

先创建drawable/progressbar_color.xmlxml version="1.0" encoding="utf-8"?>layer-list xmlns:android="http://schemas.android.com/apk/res/android"> android:id="@android:id/background">

2016-06-14 10:49:22 356

原创 listview调用notifyDataSetChanged()后不刷新界面

listview的item数量有改变时调用notifyDataSetChanged()后不刷新界面解决方法:调用notifyDataSetChanged()后调用notifyDataSetInvalidated ()public void notifyDataSetChanged ()与notifyDataSetInvalidated()的区别:1) notifyDataSetCh

2016-06-14 10:28:54 6427

转载 技术网站http://www.github.com/

http://www.runoob.com/w3cnote/android-tutorial-eclipse-adt-sdk-app.html   菜鸟教程http://www.jsoneditoronline.org/  JSON解析http://developer.android.com/index.html

2016-05-02 20:51:22 15216

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除