Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

android - 布局中的Android绘图分隔符/分隔线?(Android Drawing Separator/Divider Line in Layout?)

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.

(我想在布局的中间画一条线,并将其用作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

(谢谢)

  ask by Androider translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

To add vertical separator, switch the layout_width and layout_height values

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...