在Android上的TextView下绘制线 [英] draw line under TextView on Android

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

问题描述

我有一个可以动态添加文本视图的布局,并且我想用行将每个文本视图分开.

I have a layout that adds textviews dynamically and i want to divide each textview with a line.

类似的东西:

TextView

TextView

TextView

我已经找到了在文本下划线的方法,但是我想用固定大小的线条画出而不在文本下划线.

I have found ways to underline the text, but i want draw a line with fix size not underline the text.

有人可以帮我吗?

最好的问候

推荐答案

这与在HTML中使用<hr>标记最简单,最相似:

This is the simplest and most similar to using the <hr> tag in HTML:

将此内容放置在XML布局中您想要的行的位置:

Put this in your XML layout where you want the line:

<View 
   android:layout_width="fill_parent"
   android:layout_height="1dp"       
   android:background="#ffffff" />

这将在屏幕上绘制一条1 dp厚的白线.如果要将其设置为固定宽度,只需将layout_width更改为所需的dp大小即可.将background更改为您选择的HTML颜色代码.

This will draw a white line, 1 dp thick, across the screen. If you want it to be a fixed width, just change the layout_width to the dp size you want. Change the background to the HTML color code of your choice.

这篇关于在Android上的TextView下绘制线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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