首页 > 移动平台 > 详细

android 悬浮覆盖状态栏的相关建议

时间:2016-01-15 20:03:14      阅读:268      评论:0      收藏:0      [点我收藏+]

  WindowManager.LayoutParams.TYPE_SYSTEM_ERROR 显示在所有的应用之上包括显示在状态栏上,相对于TYPE_SYSTEM_OVERLAY不能获取焦点更为理想。

  另获取状态栏大小的方法可以使用如下方式:  

1 public static int getStatusBarHeight(Context context) {
2   int result = 0;
3   int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
4         if (resourceId > 0) {
5       result = context.getResources().getDimensionPixelSize(resourceId);
6         }
7         return result;
8     }

  发送邮箱信息可以如下显示:

 public static void sendEmail(Context context, String recipient) {
     sendEmail(context, new String[]{recipient}, null, null, null);
}

public static void sendEmail(Context context, String[] recipients, String subject, String text, Uri stream) {
    context.startActivity(createSendEmailIntent(recipients, subject, text, stream));
}

public static Intent createSendEmailIntent(String[] recipients, String subject, String text, Uri stream) {
  Intent i = new Intent(Intent.ACTION_SEND);
    i.setType("message/rfc822");
    if (recipients != null) {
    i.putExtra(Intent.EXTRA_EMAIL, recipients);
    }
    i.putExtra(Intent.EXTRA_SUBJECT, subject);
  if (!TextUtils.isEmpty(text)) {
    i.putExtra(Intent.EXTRA_TEXT, text);
  }
  if (stream != null) {
    i.putExtra(Intent.EXTRA_STREAM, stream);
  }
  return i;
}

 

android 悬浮覆盖状态栏的相关建议

原文:http://www.cnblogs.com/toolbear/p/5134009.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!