不同分辨率的文字大小文字大小、分辨率、不同

2023-09-04 03:03:59 作者:流年未逝已成殇

我使用的是Galaxy Tab的1,7寸华电国际和Galaxy Tab的加分,7寸的华电国际,但更高的分辨率,而在我的应用程序,文字可以读罚款的Galaxy Tab,但在Galaxy Tab的再加上有太多的小。 使用SP的字体大小和布局,大型林。任何想法?谢谢

i am using a galaxy tab 1, 7inch hdpi and a galaxy tab plus, 7 inch hdpi but more resolution, and in my application, the text can be read fine in galaxy tab but in galaxy tab plus there are too much small. Im using sp in font size and layout-large. Any idea? Thanks

推荐答案

这应该是一些帮助你,如果你想通过程序设置的大小。文本将在相同的大小显示每个设备上的

This should be some help for you if you want to set size programmatically. Text will show in the same size on each device

TextView text = new TextView(this);
text.setText("text");
text.setTextSize(16 * getResources().getDisplayMetrics().density);
 
精彩推荐
图片推荐