1。全屏显示,取消标题栏和状态栏

    requestWindowFeature(Window.FEATURE_NO_TITLE);     //取消标题    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,     WindowManager.LayoutParams.FLAG_FULLSCREEN);   //取消状态栏

2.图片由浅到深显示。使用滤镜

AlphaAnimation alp = new AlphaAnimation(0.1f,1.0f);   //透明度由0.1到1.0渐变alp.setDuration(3*1000);   //全部显示过程3秒钟ImageView image = new ImageView(this);image.startAnimation(alp);  //启动指定的绘制alp.setAnimationListener(new AnimationListener() {@Overridepublic void onAnimationStart(Animation animation) {}@Overridepublic void onAnimationRepeat(Animation animation) {}@Overridepublic void onAnimationEnd(Animation animation) {//当显示完成之后才做某事}});

3。检测手机网络是否畅通

 public static boolean checkNet(Context context){    /*根据系统服务获取手机连接管理对象*/    ConnectivityManager connectivity = (ConnectivityManager)context.    getSystemService(Context.CONNECTIVITY_SERVICE);    if(connectivity!=null){    NetworkInfo info = connectivity.getActiveNetworkInfo();    if(info!=null && info.isConnected()){       //判断当前网络是否连接    if(info.getState()==NetworkInfo.State.CONNECTED){    return true;    }    }    }    return false;    }    如果网络不通,可使用下面的服务进入手机的网络配置    startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));

4.关于提示alert

(1) .使用toast

Toast tst =Toast.makeText(this,"text",Toast.LENGTH_SHORT);tst.show();

(2) 。使用一个alert dialog box

AlertDialog dialog = new AlertDialog.Builder(this).create();dialog.setTitle("标题部分");dialog.setMessage("提示消息");dialog.setButton(DialogInterface.BUTTON_POSITIVE,"button value", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {//某操作}});dialog.setButton(DialogInterface.BUTTON_NEGATIVE,"button value", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {//某操作}});dialog.setButton(DialogInterface.BUTTON_NEUTRAL,"button value", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {//某操作}});

这里完善一下alertdialog,由于内容很多这里只贴一下图加点简单介绍。

①list dialog即一个dialog中含有一个列表


android study

②一个含有进度条的dialog


android study

③dialog中含有单选列表 相当于radio组


android study

④dialog中多选按钮列表,相当于checkBox组


android study

⑤自定义dialog中的布局,图中登录框为自定义的视图


android study

顺便说一句。dialog列表中的数据还可以冲数据库中读取,因为builder中有方法

setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn,.....可以传递一个cursor

(3).使用Notification in Status Bar.关键代码如下

第一种方法普遍的Notification:

       //第一步:创建notification管理类NotificationManagerString ns = Context.NOTIFICATION_SERVICE;NotificationManager manager = (NotificationManager)this.getSystemService(ns);//二,创建notification实例,参数1为显示的图片,2为提示文字,3是什么时候执行Notification notification = new Notification(R.drawable.dback, "下载完成", System.currentTimeMillis());//定义notification的额外信息和intentIntent intent = new Intent(this,StatusBarActivity.class);PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);notification.setLatestEventInfo(this, "下载", "下载完成", pendingIntent);//传入notification到NotificationManager中manager.notify(notiId, notification);

第二种方法。定制自己的notification提示信息

       //自己使用布局定制一个提示信息String ns = Context.NOTIFICATION_SERVICE;NotificationManager manager = (NotificationManager)this.getSystemService(ns);Notification notification = new Notification(R.drawable.dback, "自制提示信息", System.currentTimeMillis());RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification_layout);  //指定自己的提示ui布局文件contentView.setImageViewResource(R.id.image, R.drawable.notification_image);contentView.setTextViewText(R.id.text, "Hello, this message is in a custom expanded view");notification.contentView = contentView;Intent notificationIntent = new Intent(this, StatusBarActivity.class);PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);notification.contentIntent = contentIntent;manager.notify(notiId, notification);

5.解决android软键盘挡住控件方法:

getWindow().setSoftInputMode(modes);/*moeds有三个值:默认WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZEWindowManager.LayoutParams.SOFT_INPUT_ADJUST_PANmodes为第二个或第三个可以解决问题*/

6.使用wake locks

开启你的手机应用,当你一定时间不与你的手机交互时,手机屏幕将会暗淡下去。使用wake locks 会使手机屏幕一直处于激活状态。

使用方式:首先在manifestw文件中配置 user-perssion 值为android.permission.WAKE_LOCK。

然后:PowerManager powerManager =                     (PowerManager)context.getSystemService(Context.POWER_SERVICE);WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Lock");

开启wake locks使用方法:wakeLock.acquire();

当你的应用暂停或者退出时释放:wakeLock.release();

一般我们在activity中的onCreate方法中创建wakeLock对象

在onResume方法中调用WakeLock.acquire()

在onPause方法中调用wakeLock.release();

7.关于drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)方法

这个方法我看了很久,并做了一些测试,终于弄明白了。

这个方法可以用来剪辑一张图片的一部分,即当我们把一组图片做成一张时,我们可以用此方法来剪辑出单个图片。

bitmap的默认坐标是0,0.我们可以在此基础上剪图片。矩形src为我们所剪辑的图片的包围框,即你所剪的图片,如果为空,就是整张图片。矩形dst容纳你所剪的图片,然后根据此矩形的位置设置图片的位置。此参数不能为空。当你剪的图片大小大于dst时,多余的部分将不会显示。

其他参考 http://www.cnblogs.com/zhengtao/articles/1930802.html

8.设置自己的Mp3为铃声

String filePath = MP3的sd卡地址RingtoneManager.setActualDefaultRingtoneUri(this, RingtoneManager.TYPE_RINGTONE, Uri.parse("file://"+filePath));

9. 设置背景透明度及其颜色

转:

半透明<Button android:background="#e0000000" ... />
透明<Button android:background="#00000000" ... />
颜色和不透明度 (alpha) 值以十六进制表示法表示。任何一种颜色的值范围都是 0 到 255(00 到 ff)。对于 alpha,00 表示完全透明,ff 表示完全不透明。表达式顺序是“aabbggrr”,其中aa=alpha(00 到 ff);bb=blue(00 到 ff);gg=green(00 到 ff);rr=red(00 到 ff)。例如,如果您希望对某叠加层应用不透明度为 50% 的蓝色,则应指定以下值:7fff0000

Java代码
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值 ,0为完全透明,255为不透明

10.关于android杀毒软件的实现及其原理


http://blog.csdn.net/furongkang/article/details/6915644

............暂时这几个,以后会追加。

更多相关文章

  1. Android和IOS录制mp3语音文件的方法
  2. Android中多层Fragment嵌套,调用相册返回Uri无法显示图片的问题解
  3. android 保持屏幕长亮及解锁的方法
  4. Android WebView图片显示问题
  5. android 缩放图片与内存溢出
  6. android image cache 图片缓存 异步 下载
  7. Android获取屏幕宽高的方法
  8. android studio中.9.png图片处理
  9. 【Android开发小记--9】触摸事件---实现双指缩放图片

随机推荐

  1. Eclipse中怎样安装Andriod ADT的插件
  2. react-native android手机webview加载htm
  3. Android Framework内核之旅
  4. 探究Android中浏览器UA的生成策略
  5. Android(安卓)CheckBox 控件突然报错
  6. android中三种onClick事件的实现,与对比
  7. android 线程 synchronized关键字
  8. 自定义ViewPager实现图片自动轮播无限循
  9. android rle格式开机logo制作
  10. android4.4调整音量调节速度