处理ImageView触摸事件

时间:2017-06-29 02:20:45

标签: android android-layout

我在android studio 2.3.1中创建游戏,第一个屏幕是开始屏幕。当用户触摸开始屏幕时,他们假设进入游戏场景。图像被视为背景,但保存为Imageview。我一直试图找到帮助,但我没有收到它,我不知道从哪里开始。这就是我所要求的帮助。

activity_start:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.user.app.StartActivity"
>

<ImageView
    android:id="@+id/start"
    android:layout_width="600dp"
    android:layout_height="380dp"
    android:layout_marginBottom="-10dp"
    android:layout_marginRight="1dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.444"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:srcCompat="@drawable/start" />


</android.support.constraint.ConstraintLayout>