前提・実現したいこと
Android studioにて初めてアプリ作成しているものです。
エラーが発生しているためお助け願いたいです。
発生している問題・エラーメッセージ
全てのクラスで「R」のみ赤くなっている状況です。
エラーメッセージ
「シンボルRを解決できません」
該当のソースコード
package (こちらは控えさせていただきます);
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(**R**.layout.activity_main); boolean flag = false; // ボタンを設定 ImageButton button = (ImageButton) findViewById(R.id.imageButton3); //クリック判定を設定 button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SubActivity.class); startActivity(intent); } }); }
}
XML
<?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=".MainActivity">
<ImageView android:id="@+id/imageview1" android:layout_width="1169dp" android:layout_height="754dp" android:layout_alignParentTop="true" android:layout_marginBottom="8dp" android:layout_marginEnd="8dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginStart="8dp" android:contentDescription="TODO" android:src="@drawable/town" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.734" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" /> <ImageButton android:id="@+id/imageButton3" android:layout_width="383dp" android:layout_height="141dp" android:layout_marginBottom="16dp" android:background="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="parent" app:srcCompat="@drawable/startBottn" tools:ignore="MissingConstraints" />
</android.support.constraint.ConstraintLayout>
試したこと
クリーン、再ビルド、再起動、プロジェクト新規で作成しソースのみ移す・・・
といったことをしましたがどれも解決出来ませんでした。
回答3件
あなたの回答
tips
プレビュー