Android - shape on horizontal line

假装没事ソ 提交于 2020-01-13 10:56:26

问题


I have a xml, that in this xml I adding Horizontal Line between TextViews. I add a Shape to separator but I can't see changes.

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" />

and my 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>

For example I need :


回答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>


来源:https://stackoverflow.com/questions/29512278/android-shape-on-horizontal-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!