我陷入了困境。 我为 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>
这是行不通的.. :( 在这方面的任何帮助将不胜感激。
谢谢。
最佳答案
查看这篇关于尺码的最新博文:http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html
A typical 7” tablet has a 1024x600 mdpi screen. This also counts as a large screen.
The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this.
因此,您需要将 Galaxy 视为具有 hdpi 的大屏幕。 HTC Flyer 将是大尺寸屏幕,但具有 mdpi。
在指定尺寸时,您需要坚持使用 dp,因为这会标准化所有尺寸以针对不同密度的屏幕进行适当缩放。使用维度在 xml 值资源中指定。
正如 milind 所暗示的(我认为),最好为这两种屏幕尺寸使用相同的样式并指定一个 dimen 资源。然后可以针对不同的显示器自定义此资源。
然而,最重要的是,您使用的是基于屏幕尺寸的文本尺寸差异。文本大小应以 dp 表示,因此它会根据任何屏幕密度进行缩放。实际上,唯一应该基于屏幕尺寸的资源是布局。
关于android - 支持多分辨率设备Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7077407/