[英]How to position images at the same spot all android devices?
I have to position the images on my layout such that it does not change its position with varying screen resolutions. 我必须将图像放置在布局上,以使其不会随着屏幕分辨率的变化而改变其位置。 They should be exactly where they are placed.
它们应该准确地放置在它们的位置。 layout_weight attribute can be used with linear layout.
layout_weight属性可以与线性布局一起使用。 But I am using relative layout and I am dealing with cropped images.
但是我正在使用相对布局,并且正在处理裁剪的图像。 Any solution on how to position the image views?
关于如何定位图像视图的任何解决方案? Setting out margin height and width is not worth.
设置边距的高度和宽度是不值得的。
In short - you can't. 简而言之-您不能。 Devices have different resolutions as well as screen sizes ratio.
设备具有不同的分辨率以及屏幕尺寸比率。 Thus it's impossible for the app to look
same
because there is no same
definition in Android. 因此,应用程序看起来不可能
same
因为Android中没有same
定义。 The only way to design an interface - is to use bindings to other objects or parent view's borders. 设计界面的唯一方法-是使用对其他对象或父视图边框的绑定。 Try to investigate what are the rules, eg "to the bottom of the picture with 10dp gap" or "next to the TextView" - and it's the constants that are kept on every device.
尝试研究什么规则,例如“到图片底部有10dp间隙”或“紧挨TextView”-这是每个设备上保留的常量。
I can't imagine a scenario where this makes sense but it obviously must exist since the Android team built support for it. 我无法想象有一个合理的方案,但是显然它必须存在,因为Android团队已经建立了对此的支持。 The docs on the dimension type clearly state that it supports "mm" and "in" as qualifiers for millimetres and inches respectively.
尺寸类型上的文档明确指出,它分别支持“ mm”和“ in”作为毫米和英寸的限定符。
That should get you what you need but I would advise reevaluating that requirement, as it would make design a massive pain. 那应该可以满足您的需求,但我建议您重新评估该要求,因为这会使设计感到痛苦。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.