单击第一个项目时浮动按钮活动未打开

时间:2017-08-04 08:10:01

标签: java android

我是新手......我在我的应用程序中添加了浮动按钮,并在第一项中添加了一个单击活动,但是当我点击第一项应用程序时,不幸停止帮助我...

MainActivity.java

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/registerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/gradient_morning_background"
    tools:context="com.ignite.a01hw909350.kolamdemo.RegistrationActivity">

    <ImageView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:adjustViewBounds="true"
        android:alpha="0.37"
        android:scaleType="fitXY"
        android:src="@drawable/background_img" />

    <ImageView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:adjustViewBounds="true"
        android:alpha="0.37"
        android:rotation="180"
        android:scaleType="fitXY"
        android:src="@drawable/background_img" />

    <LinearLayout
        android:id="@+id/registerContentLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical"
        android:padding="16dp">

        <EditText
            android:id="@+id/regUsername"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/username"
            android:inputType="textEmailAddress"
            android:padding="10dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <EditText
            android:id="@+id/regNickname"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/nickname"
            android:inputType="textEmailAddress"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <EditText
            android:id="@+id/regEmail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/email"
            android:inputType="textEmailAddress"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <EditText
            android:id="@+id/regPassword"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/password"
            android:inputType="textPassword"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <EditText
            android:id="@+id/regDOB"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/dob"
            android:inputType="date"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <EditText
            android:id="@+id/regTOB"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/tob"
            android:inputType="time"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <Spinner
            android:id="@+id/lang"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:padding="5dp"
            android:prompt="@string/language" />

        <EditText
            android:id="@+id/regPOB"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:background="#e6f3f0"
            android:hint="@string/pob"
            android:inputType="textAutoComplete"
            android:padding="7dp"
            android:textColor="@color/primary_text"
            android:textColorHint="@color/secondary_text" />

        <Button
            android:id="@+id/regSubmit"
            style="@style/Widget.AppCompat.Button.Colored"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/submit"
            android:textAllCaps="false"
            android:textColor="#fff"
            android:theme="@style/RegistrationButton" />
    </LinearLayout>

    <ImageView
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_above="@id/registerContentLayout"
        android:layout_centerInParent="true"
        android:layout_marginBottom="15dp"
        android:src="@drawable/logo" />

</RelativeLayout>

see in screenshot

1 个答案:

答案 0 :(得分:-1)

不要忘记将您的活动添加到AndroidManifest.xml文件