如何为nexus5和nexus 5x设置正确的边距 [英] how to set correct margin for nexus5 and nexus 5x

查看:150
本文介绍了如何为nexus5和nexus 5x设置正确的边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发应用程序,现在我遇到了很大的问题.

I am developing the app and now I have very big problem.

我们知道nexus 5和nexus 5x使用相同的资源目录(xxhdpi),由于某些空白,我的视图被破坏了.

As we know nexus 5 and nexus 5x using the same resource directory (xxhdpi) my view getting broken because of some margins.

即我必须为nexus 5输入40dp,为nexus5x输入65dp.

i.e I have to put 40dp for nexus 5 and 65dp for nexus5x.

那么,该怎么做才能使其在2个设备中运行? 有没有办法为两个设备设置正确的布局尺寸.

So what should do here to make it works in 2 devices? Is there a way to set layout dimensions correct for both devices.

推荐答案

您必须使用 Android百分比支持库,它将布局视图划分为百分比....

You have to use Android Percent Support Lib which divide your layout View into Percentage....

很容易使用百分比设置视图,这对所有设备有用,并且在所有设备中 UI相同 .....

It is easy to set Views using Percentage which is useful for all device and UI is same in all device .....

使用下面的链接....

Use below link ....

Android百分比支持库

我认为它可以解决您的问题....

I think it solve you problem ....

享受编码....

这篇关于如何为nexus5和nexus 5x设置正确的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆