支持多种分辨率的Android设备
我陷入了困境。 我为 Samsung Galaxy Tab 7" 创建了一个应用程序。当我在 HTC Flyer 上运行相同的应用程序时,它显示的字体非常小。
我尝试了以下操作: 我想可能是 HTC Flyer 的屏幕是 xhdmi,所以我相应地创建了文件夹,
res -> values-large-xhdmi -> styles.xml -> <item textsize>20</item>
res -> values-large-> styles.xml -> <item textsize>16</item>
但这不起作用..:( 在这方面,我们将非常感谢任何帮助。
谢谢。
I am stuck in a situation.
I created an application for Samsung Galaxy Tab 7". The same application when i run on the HTC Flyer it shows very small fonts.
I tried following :
I thought may be the screen of HTC Flyer is xhdmi so i crated folders accordingly
res -> values-large-xhdmi -> styles.xml -> <item textsize>20</item>
res -> values-large-> styles.xml -> <item textsize>16</item>
this is not working.. :(
any help will be highly appreciable in this regard.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看最近关于尺寸的博客文章: http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html
因此,您需要将 Galaxy 视为具有 hdpi 的大尺寸屏幕。
HTC Flyer 将配备大尺寸屏幕,但具有 mdpi。
指定尺寸时,您需要坚持使用 dp,因为这会标准化所有尺寸,以便针对不同密度的屏幕进行适当缩放。使用维度在 xml 值资源中指定。
正如 milind 暗示的那样(我认为),最好对这两种屏幕尺寸使用相同的样式并指定 dimen 资源。然后可以针对不同的显示定制该资源。
然而,最重要的是,您使用的文本大小差异取决于屏幕尺寸。文本大小应以 dp 表示,因此它将根据任何屏幕密度进行缩放。实际上,唯一应该基于屏幕尺寸的资源是布局。
Check out this recent blog post on sizes: http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html
So you need to think of the Galaxy as a large sized screen but with hdpi.
THe HTC Flyer will be large sized screen but with mdpi.
When specifying sizes you need to stick with dp, as this normalizes all sizes to scale appropriately for the different density screens. Use a dimension to specify in a xml value resource.
As milind hinted (i think), it is probably better to use the same style for these two screen sizes and specify a dimen resource. This resource can then be customized for the different displays.
The bottom line, however, is that you are using text size differences based on the screen size. The text size should be indicated in dp, so it will scale accordingly to any screen density. Really, the only resources that should be based on screen size are layouts.
如果您打算制作支持多分辨率的 Android 应用程序,您只需关心图像和 xml,无需将三个不同尺寸的相同图像放入不同的文件夹中,例如drawable-hdpi、drawable-ldpi、drawable-mdpi。您可以使 style.xml 对所有人通用。
谢谢
If you are plan to make Multiple resolution Supporting android application just you have care about image and xml no other needs that you have same images with three different size putting in different folders like drawable-hdpi, drawable-ldpi, drawable-mdpi. you can make style.xml common for all.
Thanks