android 如何绘制一条线并将其从屏幕中拖出?
how to draw a line and be able to drag it from screen in android?
我是 android 的新人..我正在想办法画一条线
在背景上?....
从用户的角度来看,他将能够移动线,但只能移动被单击和拖动的部分。
比如将直线移动到香蕉形状(弯曲它)。
您需要自定义视图。您可以通过捕获和处理触摸事件并使视图无效来进行拖动。然后在 onDraw 中根据最后一次触摸事件绘制正确的形状。
<View
android:id="@+id/verticalLine"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/white" <!-- change the color of your line -->
/>
我是 android 的新人..我正在想办法画一条线 在背景上?.... 从用户的角度来看,他将能够移动线,但只能移动被单击和拖动的部分。 比如将直线移动到香蕉形状(弯曲它)。
您需要自定义视图。您可以通过捕获和处理触摸事件并使视图无效来进行拖动。然后在 onDraw 中根据最后一次触摸事件绘制正确的形状。
<View
android:id="@+id/verticalLine"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/white" <!-- change the color of your line -->
/>