It is not a clean and rebuild issue AT ALL! Make module will not resolve this issue either. This is the only FlotingActionButton I'm using in my code. One solution said this only occurs with an anchor parameter but as you can see I am not using one so I dont know what to make of it.
<?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/activity_main"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/coverpic"
tools:context="com.android.nohiccupsbeta.MainActivity">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/effects_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="top|end"
android:layout_marginTop="400dp"
android:layout_marginRight="15dp"
android:src="@drawable/ic_book"
app:backgroundTint="@color/primary_color" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/take_test"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:backgroundTint="@color/primary_color"
android:src="@drawable/ic_handcuffs" />
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
This is the JAVA code. I tried importing the Coordinator Layout but that is not possible. I also tried declaring the fab var differently just to get the same error :
package com.android.nohiccupsbeta;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, pageone.class));
}
});
FloatingActionButton fab2 = (FloatingActionButton)findViewById(R.id.fab2);
fab2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, BacTest.class));
}
});
}
}