How do I drag a button on an image?

微信扫一扫,分享到朋友圈

How do I drag a button on an image?

I do not want an image button, I just needs this button in a certain position on an image.

Use this in relative layout:

<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@string/app_name" />
<Button
android:id="@+id/button_1"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignTop="@+id/imageView1"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp" />

Use the marginLeft and marginTop to set specifically where to place the button accordint to the image . The imageview contains your image

微信扫一扫,分享到朋友圈

How do I drag a button on an image&quest;

svelte-flex - A simple and reusable flexbox component for Svelte

上一篇

Rails Helpers&colon; Add a break line at the end of a content&lowbar;tag in the helper method

下一篇

你也可能喜欢

How do I drag a button on an image&quest;

长按储存图像,分享给朋友