【问题标题】:Textview with a bottom drawing custom line带有底部绘图自定义线的 Textview
【发布时间】:2013-02-28 14:35:49
【问题描述】:

我只是想知道如何做这样的事情:

谢谢

【问题讨论】:

  • 设计这样的布局还是什么?
  • 嘿,有两种方法可以做到这一点 1)获取荧光弧的图像 2)为半半圆创建一个 xml 并在您的 layout.xml 中创建一个视图并将此 xml 作为背景到视图。

标签: android textview line customization draw


【解决方案1】:

drawableBottom 设置为您的TextView,例如:

<TextView
      android:id="@+id/my_txt"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:drawableBottom="@drawable/my_drawable" />

,其中my_drawable 位于您的资源文件夹中,这就是您想要在TextView 下的绿线。

【讨论】:

  • 谢谢!我的第一个想法是让它画线,但图片应该可以:)
  • 这将花费您更多的时间来绘制而不是仅使用 png 文件并将其附加到您的文本视图。 :)
【解决方案2】:

你可以用android:drawableBottom="@drawable/YourDrawing"做到这一点

像下面这样..

 <TextView
            android:id="@+id/TV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="23:00"
            android:drawableBottom="@drawable/YourDrawing"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/blue"
            android:textStyle="bold" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-07
    • 1970-01-01
    • 2020-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多