当前位置: 首页 > news >正文

营销类的网站金蝶财务软件

营销类的网站,金蝶财务软件,爱南宁app下载,阿里云网站建设程序注:编译 sdk 需要使用 30 因为引入了 WindowMetrics、uild.VERSION_CODES.R 新 sdk 才存在的类和属性 某些场景处理 view ,对 view 显示的位置要求比较精确,通常我们使用context.getResources().getDisplayMetrics().widthPixels 获取到的宽、…

注:编译 sdk 需要使用 30

因为引入了 WindowMetrics、uild.VERSION_CODES.R 新 sdk 才存在的类和属性

某些场景处理 view ,对 view 显示的位置要求比较精确,通常我们使用context.getResources().getDisplayMetrics().widthPixels 获取到的宽、高是不包含状态栏等高度,在计算坐标、偏移量时可能就不精确了,那么就需要获取设备的物理尺寸——包含状态栏高度等不显示区域。

import android.graphics.Point;
import android.graphics.Rect;
import android.util.Pair;
import android.util.Size;
import android.view.WindowManager;
import android.view.WindowMetrics;import androidx.annotation.RequiresApi;@RequiresApi(api = Build.VERSION_CODES.R)
private static Size getPhysicalScreenSize30(Context context) {WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);if (windowManager != null) {WindowMetrics windowMetrics = windowManager.getCurrentWindowMetrics();Rect bounds = windowMetrics.getBounds();return new Size(bounds.width(), bounds.height());}return new Size(-1,-1);
}@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private static Size getPhysicalScreenSize29(Context context) {WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);if (windowManager != null) {Point size = new Point();windowManager.getDefaultDisplay().getRealSize(size);return new Size(size.x, size.y);}return new Size(-1,-1);
}public static Pair<Integer, Integer> getPhysicalScreenSize(Context context) {int w = -1, h = -1;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {Size size = getPhysicalScreenSize30(context);w = size.getWidth();h = size.getHeight();} else {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {Size size = getPhysicalScreenSize29(context);w = size.getWidth();h = size.getHeight();}}if (w != -1 && h != -1) {return new Pair<>(w, h);}//最不济的情况就返回非物理尺寸吧w = context.getResources().getDisplayMetrics().widthPixels;h = context.getResources().getDisplayMetrics().heightPixels;return new Pair<>(w, h);
}
http://www.yayakq.cn/news/174542/

相关文章:

  • 做旅游的网站的需求网站建设补充
  • 网站开发与设计英文书籍金山石化网站建设
  • 上海做网站推广关键词个人能建设网站吗
  • 网站用户体验优化方案网站核验为个人实际是公司
  • 怎样建立营销网站网站建设需要知识
  • 自己做网站咋做南京手机app开发公司
  • iis7 asp网站 503wordpress改手机布局
  • 网站伪静态如何配置文件wordpress 为什么评论不能显示
  • 中文网站 可以做谷歌推广吗做爰片的网站
  • php可视化网站开发宁波企业网站设计
  • php网站开发需要学什么软件苏州嘉盛建设
  • 滨海新区建设和交通局网站noip免费域名申请
  • 建企业网站程序系统国外有没有做问卷调查的网站
  • 网站制作流程分为哪三步全国美容网站建设
  • 佛山如何建立网站互联网行业裁员
  • 网站seo竞争分析工具口腔网站设计图
  • 网站怎么维护更新零基础学网站开发
  • 上海市建设工程交易管理中心网站公司网站制作与推广
  • 网站建设免费的服务器学做吃的的网站
  • 网站建设丿金手指谷哥12英国做电商网站
  • 太仓高端网站制作网站关键字怎么做
  • 兰州市做网站的北京代理网站备案
  • 长沙网站推广公司平面设计线
  • 免费的作文网站宁波seo服务快速推广
  • 做外贸翻译用哪个网站好网站策划书包括哪些内容
  • 什么是建设网站工具工业物联网平台
  • 网站源码 照明旅游网站开发选题背景
  • 犀牛做网站的公司今天特大军事新闻
  • 免费绑定域名的建站wordpress 双语模板
  • 沈阳网站页面设计公司wordpress调用当前子分类