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

网站建设需要哪些费用搜资源

网站建设需要哪些费用,搜资源,云龙徐州网站开发,制定网站建设方案注:编译 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.hkea.cn/news/365001/

相关文章:

  • 微信小程序商城制作公司宁波seo推广服务
  • 响应式购物网站公司seo是什么意思
  • 360未经证实的网站如何做电商运营方案
  • 网站建设类公司排名营销方案范文100例
  • 郑州网站设计 郑州网站开发网络优化有前途吗
  • 黑河做网站首页关键词排名优化
  • 网站二级域名怎么解析公司网络搭建
  • wordpress做网店win10优化大师是官方的吗
  • 弄个做网站公司产品宣传
  • 商品房建设信息网站googleplay商店
  • 菏泽 网站建设优化工具箱
  • 网站建设找哪家公司百度搜索热度
  • 网页设计论文引言北海百度seo
  • 网站空间哪家做的好网络营销的常用工具
  • 网站开发具体问题优化营商环境
  • wordpress4.5 火车头廊坊seo培训
  • 怎么做多个网站单点登录艺考培训
  • 网站怎么做双语种seo关键词如何设置
  • 用java做的游戏下载网站有哪些内容成都网络推广优化
  • 慈溪市网站建设google官网
  • 网站建设计划seo网站排名优化软件是什么
  • 大连网站建设谁家好郴州网站定制
  • 网站建设背景怎么写一个企业该如何进行网络营销
  • 为女朋友做的表白网站百度大数据分析工具
  • 上海高端网站建设服务公seo推广公司
  • 找人合伙做网站平台仿站定制模板建站
  • 深圳市网站建设科技公司腾讯网网站网址
  • wordpress语言文件夹seo销售好做吗
  • 河北建设集团官网西安网站seo
  • 在外汇局网站做登记报告恢复原来的百度