我正在为7英寸平板电脑开发应用程序,更特别的是为nexus7开发,在XML布局文件中,我得到了警告
避免使用小于12sp的大小:11sp
如果我设置任何文本字段的大小小于12sp?我正在添加屏幕截图,以便更清楚地了解问题
xwbd5t1u1#
对于默认字体缩放,1 sp = 1dip = 1/160”。11 sp的高度大约是1/15英寸,相当微小。这是一个Lint错误。您可以覆盖它--按<Ctrl>-<1>,快速修复列表菜单应该给予显示该消息。但是,如果你尝试12 sp,你可能会看到它也是非常小的,你想要一个更大的字体无论如何。
<Ctrl>-<1>
vjrehmav2#
您可以使用**tools:ignore="SmallSp"**忽略该警告
tools:ignore="SmallSp"
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="false" android:text="NileshRathod" android:textSize="8sp" tools:ignore="SmallSp"/>
daolsyd03#
我使用Android Studio Flamingo | 2022.2.1 Patch 1。避免使用小于11sp的大小。您应该添加到tools:ignore="SmallSp"
Android Studio Flamingo | 2022.2.1 Patch 1
11sp
<TextView android:textSize="10sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:ignore="SmallSp" />
3条答案
按热度按时间xwbd5t1u1#
对于默认字体缩放,1 sp = 1dip = 1/160”。11 sp的高度大约是1/15英寸,相当微小。
这是一个Lint错误。您可以覆盖它--按
<Ctrl>-<1>
,快速修复列表菜单应该给予显示该消息。但是,如果你尝试12 sp,你可能会看到它也是非常小的,你想要一个更大的字体无论如何。
vjrehmav2#
您可以使用**
tools:ignore="SmallSp"
**忽略该警告daolsyd03#
我使用
Android Studio Flamingo | 2022.2.1 Patch 1
。避免使用小于
11sp
的大小。您应该添加到
tools:ignore="SmallSp"