如何解决较小手机中应用程序的裁剪问题?
我有一个基本的线性布局,具有显示照片的图像视图、显示文本的文本视图等......当我在 android 2 上测试我的整个应用程序时,屏幕上从来没有任何部分不显示。但是当我在 QVGA 模拟器中测试它时,一半的视图超出了屏幕。现在,我的一些文本被定义为一定的大小。
我从不在我的任何 xml 中使用 px(仅使用 dial)。我在需要的地方使用 fill_parent、wrap_content 并且从不固定高度或长度。是否可以与我的文本一起使用,例如,textSize = 22dip?我找不到关于为什么它不适用于所有尺寸的文档。
是否某些应用程序需要根据这些屏幕尺寸进行编程?或者我错过了什么?
谢谢!
I have a basic linear layout, with image view that display photos, textviews that show text etc...and when I test my whole app on my android 2, there is never any part of the screen that doesn't show. But when I test it in the QVGA emulator, half the view is off the screen. Now, some of my text is defined to a certain size.
I never use px (only dip) in any of my xml. I use fill_parent, wrap_content where it is needed and never fix a height or length. Could it be with my text, I use say, textSize = 22dip? I couldn't find documentation on why that would not work in all sizes.
Could it be that some apps need to be programmed to those screen sizes? Or am I missing something?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DIP 实际上对流体布局设计没有帮助。 DIP 试图确保不同屏幕密度下的物体看起来尺寸相同。 (想象一下排版中点的概念)
如果没有您的代码和/或所发生情况的屏幕截图,很难判断您的程序发生了什么,但 22dip 文本大小可能是原因之一:
如果您在 QVGA 上的设置是 HDPI,那么对于一个字母来说,它实际上是 33 像素高,这会消耗超过 1/10 的空间。屏幕高度。
顺便说一句,你的 16:9 宽屏(垂直)可以在一个屏幕上容纳所有内容,而无需滚动,而 QVGA 只有 3:2 屏幕,即使所有内容都是成比例的,但肯定会隐藏一些东西。
DIP actually doesn't help in fluid layout design. DIP tries to make sure things will looks the same size across different screen density. (imagine the concept of Point in typography)
Without your code and/or screenshot of what happen, it is hard to judge what happens to your program, but 22dip text size is possibly one of the reason which:
If your setting on QVGA is HDPI, then it is actually 33 pixel tall for a letter, which consumes more than 1/10 of the screen height.
By the way, your 16:9 wide screen (vertical) may fit everything in one screen without scroll, while QVGA is only 3:2 screen, even though everything is in proportion, something would be hidden away for sure.