让字体变得更大了大屏幕上

编程入门 行业动态 更新时间:2024-10-23 23:23:01
本文介绍了让字体变得更大了大屏幕上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已搜查#1和谷歌我觉得是谁想要字体大小仍保持不变的人的答案,但我希望他们能得到更大的时候,屏幕变大。

I have searched Stackoverflow and google and what I find is answers for people who want fonts to remain the same size but I want them to get bigger when the screen gets bigger.

具体来说,我想在我的应用程序非常大的字体。在我的电话,他们是1/2英寸高 - 完美。我的问题是在我的7寸平板他们也是1/2英寸高,我希望他们能够扩大和大约1英寸高。我曾尝试SP和DP模式,都只是不停的字体相同的物理高度,这不是我想要的。我看到有一些新的东西与3.2和更高版本平板电脑,但我想从2.3及更高版本支持的设备。我所看到的复杂code,它说,它自动缩放字体,以适合在宽文但这并不是我所需要的。我想要的字体是说100SP对平板电脑和手机上200SP等效。我没有图形和简单的相对布局在屏幕上非常少的元素。我只需要一对夫妇的textsizes的大屏幕更大。我想这将是简单,但我不能找到它。

Specifically, I want very large fonts in my application. On my phone, they are 1/2 inch high - perfect. My problem is that on my 7 inch tablet they are also 1/2 inch high and I want them to scale up and be about 1 inch high. I have tried sp and dp modes and both just keep the fonts the same physical height, which is not what I want. I see there is something new for tablets with 3.2 and higher but I want to support devices from 2.3 and higher. I have seen complex code that says it auto scales fonts to fit the text in a width but that is not what I need. I want the fonts to be the equivalent of say 100sp on a phone and 200sp on the tablet. I have no graphics and simple relative layouts with very few elements on the screen. I just need to make a couple of the textsizes larger for large screens. I would think it would be simple but I can't find it.

下面是一个典型的文本视图条目

Here is a typical text view entry

<TextView android:id="@+id/textDistance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/labelDistance" android:layout_centerHorizontal="true" android:text="" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ffffff" android:textSize="100sp" />

有一个相对简单直接的方式做到这一点?

Is there a relatively simple straight forward way to do this?

推荐答案

DP或探底的尺寸 - 为特制一直在不同的屏幕相同。因此,有没有适合你的任务的任何特殊尺寸。

'dp' or 'dip' dimensions - specially made for been the same on different screens. So, there is not any special dimension for you task.

有关实施不同的文本大小,你必须创建几种风格,并把它们放在文件夹价值观XLARGE ,价值观大,值正常和值小。

For implementing different text sizes you have to create several styles, and put them in folders values-xlarge, values-large, values-normal and values-small.

一个风格将是这样的:

<style name="BigTextStyle"> <item name="android:textSize">50dp</item> <!-- different values in different folders --> </style>

而在你的文本视图只是提供样式的引用:

And in your text view just provide style reference:

<TextView style="@style/BigTextStyle" ... />

更多推荐

让字体变得更大了大屏幕上

本文发布于:2023-10-23 00:10:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519152.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:更大了   字体   屏幕上

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!