• 您当前的位置:首页 > 科技新闻 > 互联网新闻 > 腾讯wetest限免开放Android P专区 同样Android 不同的体验
  • 腾讯wetest限免开放Android P专区 同样Android 不同的体验

    时间:2018-04-18 16:17:31

    来源:Techweb

    作者:TechWeb.com.cn

    使用WiFi RTT时,需要在AndroidManifest.xml中增加如下声明:

    通过上面的简单代码,就能够实现WiFi RTT的功能。

    WiFi RTT功能适用于复杂地形的大型室内外场所,如商场、娱乐场所、大型休闲、游乐场等等,提供场所内的局部区域精确化导航等功能。相信在很快的时间内,就能够在各大地图应用内体验到这项便利功能,对于路痴、地图盲的伙伴们将是极大的福音。

    显示剪切 –支持刘海屏

    随着iPhone X的推出,“刘海屏”达到了空前的高潮。Android P里提供了对异形屏幕的UI适配兼容方案,通过DisplayCutout类提供的相关接口,能够获取到屏幕中Cutout区域的信息。

    借助DisplayCutout,可以获取到如下信息:

    DisplayCutout displayCutout = view.getRootWindowInsets().getDisplayCutout();

    if(displayCutout != null) {

    Region bounds = displayCutout.getBounds();

    Log.d(TAG, String.format("Bounds:%s", bounds.toString()));

    int top = displayCutout.getSafeInsetTop();

    int bottom = displayCutout.getSafeInsetBottom();

    int left = displayCutout.getSafeInsetLeft();

    int right = displayCutout.getSafeInsetRight();

    Log.d(TAG, String.format("Cutout edge:[left:%d, top:%d,right:%d, bottom:%d]", left, top, right, bottom));

    }

    public Region getBounds()能够获取到Cutout区域的所有信息,Region就是Cutout区域。

    public int getSafeInsetTop()

    public int getSafeInsetBottom()

    public int getSafeInsetLeft()

    public int getSafeInsetRight()

    以上四个接口,可以获取到去除Cutout区域后的安全区域边界值。

    通过上述数据,开发者能够精准的控制UI的绘制,避免将UI内容绘制到Cutout区域造成UI显示异常。

    首页<上一页12345下一页>尾页
    关键词:
    最近更新