質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

2回答

1896閲覧

android studioでこの画像のエラーの対処法

jgvkmea

総合スコア25

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2017/03/14 11:06

編集2017/03/14 12:20

android studioを使い始めたばかりの初心者です。

現状、ドットインストールなどでサンプルアプリを作成しながら、使い方を学んでいるのですが、画像のような2種類のエラーが出て困っています。

イメージ説明
イメージ説明

一応()内の場所を開いてみたり、Googleで検索してみたりしたのですが、どう対処すべきかわからず、ここで質問させていただきました。
回答よろしくお願いします。

android studioのバージョンは2.3です。

【コード】

<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.websarva.wings.android.viewsample.ViewSampleActivity"> <LinearLayout android:layout_width="387dp" android:layout_height="514dp" android:background="#A1A9BA" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffffff" android:text="@string/tv_msg" android:textSize="25sp" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp" /> <EditText android:layout_width="0dp" android:layout_height="wrap_content" android:background="#ffffff" android:inputType="text" tools:layout_editor_absoluteX="8dp" tools:layout_editor_absoluteY="0dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:background="#df7401" android:orientation="horizontal" android:padding="5dp" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="8dp"> <CheckBox android:id="@+id/cbDrink" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:background="#ffffff" android:text="@string/cbDrink" /> <CheckBox android:id="@+id/cbFood" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="25dp" android:background="#ffffff" android:text="@string/cbFood" /> </LinearLayout> <RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#df7401" android:orientation="horizontal" android:padding="5dp" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp"> <RadioButton android:id="@+id/rbMale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:background="#ffffff" android:text="@string/rbMale" /> <RadioButton android:id="@+id/rbFemale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffffff" android:text="@string/rbFemale" /> </RadioGroup> <Spinner android:id="@+id/spCurryList" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:entries="@array/sp_CurryList" android:paddingBottom="5dp" android:paddingtop="10dp" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="8dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/bt_msg" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp" /> </LinearLayout> </android.support.constraint.ConstraintLayout> コード

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yona

2017/03/14 11:30

コードを追記してください。
aja

2017/03/14 11:46

Android Studioのバージョンは2.3でしょうか?それとも2.2.3ですか?サンプルコードをそのまま写しただけだから間違っていないというのは正しくない事が多いです。現実にエラーになっているので。コードを出しましょう
yona

2017/03/14 12:08

コードはコード用の記述に修正してください。
guest

回答2

0

単純な書き写しミスでは

// paddingTop です android:paddingtop="10dp"

おそらく他にもエラー要因があると思いますが
ViewSampleActivity
など、他のコードが分からないので何とも言えません

サンプルコードはそのまま使えるところもありますが
package名などは自分の作ったプロジェクトに合わせたりしないといけません

とりあえず、元ネタを確認しましょう

投稿2017/03/14 13:59

aja

総合スコア3733

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ベストアンサー

AndroidStudioに対応する形式のプロジェクトではない場合に発生します。
現状ではあなたのプロジェクトがどのような経緯を持っているかわからないため対処方法はわかりません。

・プロジェクトはAndroidStudioで作ったものですか?
・プロジェクトは以前は動いていて、今は動かなくなってしまったんですか?

投稿2017/03/14 12:13

yona

総合スコア18155

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

jgvkmea

2017/03/14 12:18

・このプロジェクトはAndroidStudioで作ったものです。 ・ある程度作ってから動かそうと考えていたのですが、RadioGroupとButtonの間にSpinnerを書いている時に、それまではエラーが出ていなかったのに、突然該当部分がエラーになっていました。
yona

2017/03/14 13:46

まずはConstraintLayoutの子要素を全て削除してエラーがでるかを確認してください。
jgvkmea

2017/03/14 13:52

子要素を全て削除したところ、エラーが出ずに動かせました。 ここから、今消した要素を足していって、エラーの元を突き止めればいいのでしょうか?
yona

2017/03/14 14:03

そうですね、その際になるべくコード補完機能に頼ってください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問