【问题标题】:Android - shape on horizontal lineAndroid - 水平线上的形状
【发布时间】:2015-04-08 10:34:25
【问题描述】:

我有一个xml,在这个xml 中,我在TextViews 之间添加了Horizontal Line。 我在分隔符中添加了Shape,但看不到更改。

main_activity.xml :

<TextView
    android:id="@+id/title"
    android:layout_width="match_parent"
    android:layout_height="20dp"
    android:text="HELLO"
    android:textColor="@android:color/black" />

<View
    android:id="@+id/vVerticalLine"
    android:background="@drawable/horizontal_shape"
    android:layout_width="match_parent"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="20dp"
    android:layout_below="@+id/title"
    android:layout_height="10dp" />

<TextView
    android:id="@+id/txt"
    android:layout_width="match_parent"
    android:layout_height="20dp"
    android:text="HELLO"
    android:textColor="@android:color/black" />

还有我的horizontal_shape.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">

    <corners
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />

    <stroke
        android:color="#000000" />

</shape>

例如我需要:

【问题讨论】:

  • main_activity.xml的背景是白色的。
  • 使用 而不是描边。
  • @哈利。你的帮助是真的。投票的回答问题。谢谢。

标签: android android-xml android-shape


【解决方案1】:
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <corners
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />
    <size
        android:height="6dp" />
    <solid
        android:color="#daa520" />

</shape>

【讨论】:

  • 这对我有用,而在 SO 上没有其他解决方案有帮助。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-15
  • 2015-01-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-30
  • 1970-01-01
相关资源
最近更新 更多