问题描述
我要画一条直线的垂直线在我的Android活动时,一个按钮pssed $ P $。请解释如何我可以得出一个位置和放线;长度我想要的。
I want to draw a straight vertical line in my Android activity when a button is pressed. Please explain how I can draw the line with a position & length I want.
阐述:我有一个垂直方向的线性布局。一组按钮构成了这个线性布局。当我preSS一个按钮,我想一行出现这些按钮的权利,如果屏幕中间分割 - 宽度= 2DIP和高度= 200dip直线
Elaboration:I have a linear layout with vertical orientation. A set of buttons constitute this linear layout. When I press one button, I want a line to appear to the right of these buttons, as if dividing the screen halfway - a straight line of width=2dip and height=200dip.
推荐答案
我已经解决了它自己。所有你需要做的就是定义一个适当的参数的查看和使用颜色填充背景。您可能需要使用嵌套的线性布局正确定位就行了。
I have solved it myself.All you need to do is define a View with appropriate parameters and fill the background with color. You may want to use nested linear layouts for positioning the line correctly.
<View
android:id="@+id/View01"
android:layout_width="2dip"
android:layout_height="500dip"
android:background="#2B497B"
/>
所以,如果它可能是有用的其他人,我已经发布了答案在这里喽!
So if it may be useful to anyone else, I have posted the answer here myself!
这篇关于我怎么能画一条垂直线的活动,当按钮是pressed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!