質問するログイン新規登録

Q&A

解決済

1回答

1304閲覧

アンドロイドスタジオでimageViewのエラー

ashone

総合スコア8

Android Studio

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

Android Emulator

Android EmulatorはアンドロイドのOSで起動しているアンドロイドのデバイスの機能をシミュレートするソフトウェアです。Emulatorは開発者に複数の違う設定を持ったデバイスを必要とすることなくアプリケーションを開発しテストすることが可能になります。

0グッド

0クリップ

投稿2020/05/17 02:10

0

0

はじめてのアンドロイドスタジオ、第4版の本で動物図鑑を作っています。
アンドロイドスタジオでimageViewが画面中央にくるように制約を追加したのですが、黄色いエラーがでます。

Android Studio version 3.3.1
kotlin
API 19 Android 4.4 (kitkat)

よろしくお願いいたします。イメージ説明

<?xml version="1.0" encoding="utf-8"?>

<androidx.constraintlayout.widget.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=".GiraffeFragment" android:id="@+id/frameLayout3">
<ImageView android:src="@drawable/giraffe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView4" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="8dp" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="8dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

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

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

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

guest

回答1件

0

自己解決

下記を参考にしてやったらエラーがきえました。

リソースの設定
文字列の設定で、リテラルは推奨されないのでリソースに設定します。
strings.xml(app_name は自分のapp_nameに合わせてください)

<resources> <string name="app_name">TestTextView</string> <string name="text">Test TextView</string> </resources> 1 2 3 4 <resources> <string name="app_name">TestTextView</string> <string name="text">Test TextView</string> </resources>

投稿2020/05/27 11:46

ashone

総合スコア8

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.25%

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

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

質問する

関連した質問