【问题标题】:Android TextView unwanted padding issueAndroid TextView 不需要的填充问题
【发布时间】:2019-09-13 19:43:39
【问题描述】:

我在使用 android TextView 时遇到问题。在 TextView 中有不需要的空格, 空间只是偶尔出现。对于上面的参考图片,您可以在 TextView 的右端看到一些额外的空间。请帮帮我。 这是xml代码

  <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:autoLink="all"
                android:ellipsize="end"
                android:padding="0dp"                     
                android:gravity="start"
                android:text="@{message.message}"
                android:textColor="@android:color/white"
                android:textColorLink="@android:color/white"
                android:textIsSelectable="true"
                android:textSize="14sp"
                tools:text="this is the  problem i am having please helpme to find a solution" />

【问题讨论】:

  • 如果没有代码 sn-ps,我们将无法回答您的问题。发布您所需的代码。
  • 如果您要为您的 textView 添加 XML,它会更容易为您提供帮助,请添加它以使您的问题不那么广泛。
  • 您是否使用 9-patch 图像作为背景中的气泡?
  • 是的@Priyankagb,但不适用于textview,我有一个Framelayout作为文本视图的父级,9-patch图像应用于framelayout。在图像中您可以看到文本视图的边界。
  • 感谢@IntelliJAmiya 它可能有效,但我必须支持 26 之前的 API 版本

标签: android textview padding


【解决方案1】:

你可以使用这个库来证明textview

https://github.com/navabi/JustifiedTextView

 <ir.noghteh.JustifiedTextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:padding="25dp"
    xmlns:noghteh="http://noghteh.ir"
    noghteh:text="text here"
    noghteh:textColor="@color/text"
    noghteh:textSize="18sp"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-30
    • 2012-03-19
    • 1970-01-01
    • 1970-01-01
    • 2016-08-08
    • 1970-01-01
    • 1970-01-01
    • 2011-08-13
    相关资源
    最近更新 更多