布局中的 Android 绘图分隔符/分隔线? [英] Android Drawing Separator/Divider Line in Layout?

查看:17
本文介绍了布局中的 Android 绘图分隔符/分隔线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在布局的中间画一条线,并将其用作 TextView 等其他项目的分隔符.是否有一个很好的小部件.我真的不想使用图像,因为很难将其他组件与其匹配.我也希望它相对定位.谢谢

I would like to draw a line right in the middle of a layout and use it as a separator of other items like TextView. Is there a good widget for this. I don't really want to use an image as it would be hard to match the other components to it. And I want it to be relatively positioned as well. Thanks

推荐答案

我通常用这段代码来添加水平线:

I usually use this code to add horizontal line:

<View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="@android:color/darker_gray"/>

要添加垂直分隔符,请切换 layout_widthlayout_height

To add vertical separator, switch the layout_width and layout_height values

这篇关于布局中的 Android 绘图分隔符/分隔线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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