English 中文(简体)
TextView dp 不使用屏幕大小缩放
原标题:TextView dp does not scale with screen size

我正在尝试创建一个文本View, 它将占屏幕顶部中心部分的很大一部分。 理想的情况是, 在 Dp 中设置文本大小将使文本View 保持正确的相对大小( 占屏幕宽度的70%左右, 可能占屏幕顶部的20% ) 。 在布局编辑器和 HVGA 分辨率的模拟器中, 它看起来是正确的。 然而, 当我在高分辨率( 在我的平板上, 或模拟一个 720p 显示) 测试文本时, 文本会占屏幕顶部中心部分的很小一部分 。 ( 可能是 30% 宽度, 而不是 70%, 它看起来没有垂直更大 ) 。

是否有办法使案文规模化,以正确增加分辨率的相对规模?

最佳回答

Set the layout_width as fill_parent, which will make it spread across the screen for all devices. Add some padding on left right and top which seems suitable. The padding might seem different for different screens but still this might be a better solution.

问题回答

set android:layout_width="match_parent" edit: check this out Auto Scale TextView Text to Fit within Bounds





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签