安卓手机怎么清理缓存 android清除程序缓存的方法
一,系统清除
1、在你手机中“设置->应用程序 >管理应用程序”
2、然后按Menu键“按大小排序”选项 这时会有你手机中所用应用程序
3、选择要清除缓存的软件,就会出现“清除缓存”选项,点击清除缓存这样就会把清除缓存文件占据的空间是放出来。
二、利用RE管理器
首先手机要获取过ROOT高级权限
然后安装了RE管理器。
下面就准备开始清理你的手机了
1.打开RE管理器。
2.打开data / dalivik-cahce
3.把dalivik-cache里面的文件全部都删掉,不要犹豫。没错里面的文件是可以全部删除的。
4.重启手机,重启的过程中可能会比较慢就像你刷完机后第一次开机一样。
三、其它方法介绍
利用第三方法工具,如有安卓优化大师、ET优化大师、手机优化大师这三款手机优化软件在常规的开机加速、进程管理、程序管理、安装卸载、系统优化清理等常规功能表现都是不错的。
特色功能
安卓优化大师偏向于节电优化、工具箱应用功能拓展;
ET优化大师注重电量管理的同时,也重视快速省电开关的应用;
手机优化大师则具有更灵活的功能插件应用,用户可根据需要下载使用文件管理、桌面管理、系统备份、书签管理等功能。
小编给大家推荐的这篇文章介绍了Android编程实现图片透明的方法,非常实用,有兴趣的同学可以看看今天弄了一个图片的透明方法。
效果图:
目录结构
main.xml
代码如下 | 复制代码 |
<?xmlversion="1.0"encoding="utf-8"?> <LinearLayoutxmlns:Android="http://schemas.android.com/apk/res/android" android:orientation="vertical"android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageViewandroid:id="@+id/imageView"android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/icon"/> <Buttonandroid:id="@+id/alpha_plus" android:layout_width="wrap_content"android:layout_height="wrap_content" android:text="透明度增加"android:layout_gravity="center_horizontal" /> <Buttonandroid:id="@+id/alpha_minus" android:layout_width="wrap_content"android:layout_height="wrap_content" android:text="透明度减少"android:layout_gravity="center_horizontal" /> </LinearLayout> |
TOUMINGDUActivtiy
代码如下 | 复制代码 |
importandroid.app.Activity; importandroid.os.Bundle; importandroid.os.Handler; importandroid.view.View; importandroid.widget.Button; importandroid.widget.ImageView; publicclassTOUMINGDUextendsActivity { privateImageView imageView=null; privateButton alpha_plus=null;//透明度增加 privateButton alpha_minus=null;//透明度减少 privateintalpha=255;//记录ImageView的透明度 Boolean flag=true; @Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); imageView=(ImageView)findViewById(R.id.imageView); alpha_plus=(Button)findViewById(R.id.alpha_plus); alpha_minus=(Button)findViewById(R.id.alpha_minus); alpha_plus.setOnClickListener(listener); alpha_minus.setOnClickListener(listener); } privateView.OnClickListener listener =newView.OnClickListener(){ publicvoidonClick(View v) { //加加 if(v==alpha_plus){ alpha+=10; if(alpha>255){ alpha=255; } imageView.setAlpha(alpha); } //减减 if(v==alpha_minus){ alpha-=10; if(alpha<0){ alpha=0; } imageView.setAlpha(alpha); } } }; } |
OK完成....
本文介绍了Android基于ImageView绘制的开关按钮效果示例,非常实用,有兴趣的同学快来看看吧今天弄了一下用图片绘制开关按钮.
效果图:
还有我两张start图片和stop图片就是上面的图片,到时候大家可以按照自己的图片调用..
Main.xml文件
在xml进入这段代码就ok了。
代码如下 | 复制代码 |
<ImageView Android:id="@+id/start" android:layout_width="150.px" android:layout_height="80.px" android:src="@drawable/start" android:layout_x="120.0px" android:layout_y="250.0px" /> |
Activity文件
代码如下 | 复制代码 |
publicclasstwoextendsActivityimplementsOnClickListener{ privateImageView start =null;// 开始 protectedbooleanisBrewing =false;// 按钮置换 publicvoidonCreate(Bundle savedInstanceState) { //设置全屏 super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.two); // 绑定 start = (ImageView) findViewById(R.id.start); start.setOnClickListener(this); } //开始 publicvoidstartView(){ Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.stop);//打开资源图片 start.setImageBitmap(bmp); isBrewing =true; } //停止 publicvoidstopView(){ Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.start);//打开资源图片 start.setImageBitmap(bmp); isBrewing =false; } @Override publicvoidonClick(View v) { if(v==start){ if(isBrewing) stopView(); else startView(); } } } |
ok完成..
本文介绍了Android手势识别器GestureDetector使用详解,非常实用,有兴趣的同学快来看看吧以前只知道控件的onTouchEvent()事件,它的动作有MotionEvent.ACTION_DOWN、MotionEvent.ACTION_MOVE、MotionEvent.ACTION_UP;今天有个需求,要监听控件的双击、拖动、滑动等事件,这时onTouchEvent()很明显不能满足我们的需求,经多方打听,找到了今天的主角GestureDetector,下面就对它进行简单的学习。
构造方法:
已过时的有2个,不推荐使用。
GestureDetector(GestureDetector.onGestureListener listener);
GestureDetector(GestureDetector.onGestureListener listener,Handler handler);
推荐使用。
GestureDeterctor(Context context,GestureDetector.onGestureListener listener);
GestureDeterctor(Context context,GestureDetector.onGestureListener listener,Handler handler);
GestureDeterctor(Context context,GestureDetector.onGestureListener listener,Handler handler,boolean unused);
参数handler主要用来执行延时操作时使用,参数unused暂时没有使用。
从构成函数可以看出,当我们需要创建一个GestureDetector对象时,必须给它传一个GestureDetector.onGestureListener对象,查看API之后,发现它是个接口(interface),创建GestureDetector.onGestureListener的对象时,必须实现一下几个方法:
1、onDown(MotionEvent e);
当用户按下时的回调。
2、onFling(MotionEvent e1,MontionEvent e2,float velocityX,float velocityY);
当用户快速拖动,并离开屏幕时,控件还在滑动的回调。
3、onLongPress(MotionEvent e);
当用户长按控件时的回调。
4、onScroll(MotionEvent e1,MotionEvent e2,float distanceX,float distanceY);
当用户拖着控件(控件本身并没有动)滑动时的回调。
5、onShowPress(MotionEvent e);
当用户按下,还没有执行移动或者抬起的动作的回调。
6、onSingleTapUp(MotionEvent e);
用户按下,立即抬起,没有做其它动作时的回调。
有了这个监听之后,我们还可以给GestureDetector设置双击监听,使用的方法是:
mGestureDetector.setOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleListener);
参数是双击监听的对象,GestureDetector.OnDoubleTapListener它也是一个接口(interface),创建它的对象时,也必须实现以下几个方法。
1、onDoubleTap(MotionEvent e);
当用户双击时回调。
2、onDoubleTapEvent(MotionEvent e);
双击间隔事件的回调。
3、onSingleTapConfirmed(MotionEvent e);
当用户单击时回调。
上面的两个监听,回调函数都是必须实现,有时候我们不需要监听所有的事件,只对自己感兴趣的事件进行监听,GestureDetector有个内部类帮我们实现此功能GestureDetector.SimpleOnGestureListener,该类实现了GestureDetector.onGestureListener、GestureDetector.onDoubleTapListener、GestureDetector.onContextClickListener这三个接口,并实现了它们的方法,只不过是空实现,在我们需要这三个接口的时候,我们可以创建GestureDetector.SimpleOnGestureListener对象,然后需要监听哪个事件,我们就重写它的哪个方法,下面我把它的所有方法都实现了,其实和上边两个接口实现的方法是一样。
代码如下 | 复制代码 |
GestureDetector.SimpleOnGestureListener mGestureDetector =newSimpleOnGestureListener(){ @Override publicbooleanonSingleTapUp(MotionEvent e) { returnsuper.onSingleTapUp(e); } @Override publicvoidonLongPress(MotionEvent e) { super.onLongPress(e); } @Override publicbooleanonScroll(MotionEvent e1, MotionEvent e2, floatdistanceX,floatdistanceY) { returnsuper.onScroll(e1, e2, distanceX, distanceY); } @Override publicbooleanonFling(MotionEvent e1, MotionEvent e2, floatvelocityX,floatvelocityY) { returnsuper.onFling(e1, e2, velocityX, velocityY); } @Override publicvoidonShowPress(MotionEvent e) { super.onShowPress(e); } @Override publicbooleanonDown(MotionEvent e) { returnsuper.onDown(e); } @Override publicbooleanonDoubleTap(MotionEvent e) { returnsuper.onDoubleTap(e); } @Override publicbooleanonDoubleTapEvent(MotionEvent e) { returnsuper.onDoubleTapEvent(e); } @Override publicbooleanonSingleTapConfirmed(MotionEvent e) { returnsuper.onSingleTapConfirmed(e); } }; |
只有理论没有实践,怎么行呢?这里我也写了一个Demo,这个Demo是我从另一篇博客中抄的,文章的内容也是参考他的博客写的,下面会把大神的那篇博客地址贴出来。