【问题标题】:Draw line through 2 view android通过2视图android画线
【发布时间】:2014-04-10 04:11:25
【问题描述】:
我有以下两点:
|- - - - 父布局- - - -|
|- - - - A点 - - - - - - - -|
|- - - - - - - - - - - - - - - - |
|- - - - - - - - - - - - - - - - |
|- |- - - - - - - - - -|- - - - -|
|- |- 子布局-|- - - - -|
|- |- B 点- - - - -|- - - - -|
|- |- - - - - - - - - - |- - - - -|
|- - - - - - - - - - - - - - - - |
如何从 A 点画线到 B 点?
感谢大家的支持!
【问题讨论】:
标签:
android
android-layout
canvas
view
draw
【解决方案1】:
简直了
H
1.只需设计一个宽度为fillparent,高度为2dp的布局,就像背景颜色一样,然后合并到你的主布局中
2.一个简单的
<View android:width="fillparent"
android:height="2dp"
android:background="#000000/>
这样你就可以在视图中添加行了
【解决方案2】:
将此代码用于vertical 行。
如果你从 a 到 b 画线,只需给出 dp 大小的高度
<View
android:id="@+id/bottom_line1"
android:background="#000000"
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_center="true" />
horizontal 行使用这个:
<View
android:id="@+id/bottom_line1"
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_center="true" />