Android-水平线上的形状 [英] Android - shape on horizontal line

查看:127
本文介绍了Android-水平线上的形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 xml ,在此 xml 中,我添加了 Horizo​​ntal Line 之间的 TextViews
我向分隔符添加了 Shape ,但看不到更改。

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

和我的 horizo​​ntal_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>

例如我需要:

< img src = https://i.stack.imgur.com/Y8eDT.png alt =在此处输入图片描述>

推荐答案

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

这篇关于Android-水平线上的形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆