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() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public 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中含有一个列表
②一个含有进度条的dialog
③dialog中含有单选列表 相当于radio组
④dialog中多选按钮列表,相当于checkBox组
⑤自定义dialog中的布局,图中登录框为自定义的视图
顺便说一句。dialog列表中的数据还可以冲数据库中读取,因为builder中有方法
setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn,.....可以传递一个cursor
(3).使用Notification in Status Bar.关键代码如下
第一种方法普遍的Notification:
//第一步:创建notification管理类NotificationManager
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager manager = (NotificationManager)this.getSystemService(ns);
//二,创建notification实例,参数1为显示的图片,2为提示文字,3是什么时候执行
Notification notification = new Notification(R.drawable.dback, "下载完成", System.currentTimeMillis());
//定义notification的额外信息和intent
Intent 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_RESIZE
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
modes为第二个或第三个可以解决问题
*/
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
............暂时这几个,以后会追加。
- 大小: 22.1 KB
- 大小: 18.5 KB
- 大小: 23.1 KB
- 大小: 31.5 KB
- 大小: 20 KB
分享到:
相关推荐
Android Study之跳转自启动管理页,详情请查阅博文,地址如下: http://blog.csdn.net/u012400885/article/details/65515941
资源名称:Android Study 资源目录:【】AndroidStudio入门指南【】Android开发艺术探索【】疯狂Android讲义【】第一行代码第2版PDF 源码 资源截图: 资源太大,传百度网盘了,链接在附件中,有需要的同学自取。
Android study notes 安卓学习笔记
AndroidStudy [CommonHolderAndAdapter][] :通用ViewHolder&Adapter [CommonHolderAndAdapter]: 支持ListView,RecyclerView 单类型,多类型条目 [CustomView][] : 自定义控件1 [CustomView]: [RxJavaTest][] : RxJava...
Android学习过程的一些总结AndroidStudy。。。。。。。
ANDROID STUDY PDF ANDROID STUDY PDF ANDROID STUDY PDF
android study!!!!good
androidStudy
AndroidStudy Android进阶内容整理 blog地址链接: 书籍: 1.Android群英传 2.Android艺术开发与探索 3.Android设计模式 第三方框架 详细使用步骤加源码解析:1.会使用 2.懂原理 3.框架源码解析 网络框架: 1.Volley...
Android研究Jams
1. 创建广播接收器:BootBroadcastReceiver 2. 在application声明Receiver 3. 声明权限 4. 特殊说明:
AndroidStudy 记录Android 精进之路 总结学习工作中遇到的开发相关的实用技能,不断完善中,欢迎star 一起精进... 个人博客: 1.CSDN: (专注Android经验分享,以技术人的角度看世界) 2.专栏: Android性能优化专栏...
笔记 所有笔记可以通过wiki查看: 更新 增加深入剖析 JavaScriptCore: 增加读 SnapKit 和 Masonry 自动布局框架源码: 增加Swift 项目中涉及到 JSONDecoder,网络请求,泛型协议式编程的一些记录和想法: ...
关于 GDG Android Study Jam 关于本书 本书由 ( 创始人和联合组织者),供参与 2015 年 Android Study Jam 的 GDG 成员使用。 这本书是下面列出的贡献者的集体努力。 。 对存储库所做的更改会使用 webhooks 自动...
android SQLite实现本地登录注册功能,SQLite简单应用(android studio)
或在命令行上创建一个新的存储库echo # AndroidStudy >> README.md git init git add README.md git commit -m "first commit" git remote add origin git push -u origin master ...或push an来自命令行的现有存储...
AndroidStudyJam:Android Study Jam