【问题标题】:Difference in Layout Preview and actual device布局预览与实际设备的差异
【发布时间】:2017-06-10 07:26:03
【问题描述】:

我不明白为什么,但实际设备(正在运行)中我的 textView 中的文本与我的布局预览的大小不同。

这是我的 XML 文件中用于文本视图的 sn-p:

<TextView
    android:id="@+id/tournament_text_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TOURNAMENTS"
    android:layout_marginTop="8dp"
    android:layout_gravity="center"
    android:textColor="#CDDC39"
    android:textStyle="bold"
    tools:textSize="40sp"/>

以下是区别:

【问题讨论】:

  • 它有效,但我不明白为什么:P

标签: android xml textview


【解决方案1】:

tools:textSize 中使用app 而不是tools

工具用于设计时功能,例如在片段中显示哪种布局)或编译时行为,例如将哪种收缩模式应用于您的 XML 资源

查看更多详情:https://developer.android.com/studio/write/tool-attributes.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2017-06-16
    • 2020-02-07
    • 1970-01-01
    • 2013-08-05
    • 2021-10-13
    相关资源
    最近更新 更多