我是android的新手......而我只想着画一条线的方法 在背景上?.... 从用户的角度来看,他将能够移动线,但只能移动被点击和拖动的部分。 比如直线移动到香蕉形状(曲线)。
答案 0 :(得分:0)
您需要自定义视图。您可以通过捕获和处理触摸事件并使视图无效来进行拖动。然后在onDraw中,您可以根据最后一次触摸事件绘制正确的形状。
答案 1 :(得分:0)
<View
android:id="@+id/verticalLine"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/white" <!-- change the color of your line -->
/>