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

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

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

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

Q&A

解決済

1回答

448閲覧

Android studioによる、タイマー作り

ikh

総合スコア2

Android Studio

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

0グッド

0クリップ

投稿2020/08/22 08:06

編集2020/08/22 08:08

入力タイマー

xmlを作成中、デザインのコンポーネント・ツリーという項目に”!”マークが出てしまいました。

発生している問題・エラーメッセージ

This view is not constrained vertically: at runtime it will jump to the top unless you add a vertical constraint The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as layout_editor_absoluteX). These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections. Issue id: MissingConstraints ```ソースコード <EditText android:id="@+id/edit_text_input" android:layout_width="120dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:hint="Minutes" android:inputType="number" android:maxLength="4" app:layout_constraintEnd_toStartOf="@+id/button_set" tools:layout_editor_absoluteY="6dp" /> ### 試したこと 動画を見たり検索しましたが、出てきません

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

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

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

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

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

guest

回答1

0

ベストアンサー

ConstraintLayoutに配置したコンポーネントには、横方向の制約と縦方向の制約を与える必要があります。質問で示されたEditTextには横方向の制約(app:layout_constraintEnd_toStartOf)はありますが、縦方向の制約がありません。これではコンポーネントの位置決めができないためにエラーになります。

レイアウトエディターのGUI上でコンポーネントを動かすと、見た目上は位置決めができたように見えますが、それでは制約をつけたことになりません。コンポーネントをクリックすると四辺に○記号が出てきますが、上下いずれかの○記号からドラッグして親レイアウトなり他のコンポーネントなりに繋げる必要があります。今のコードでも、EditTextの右辺がbutton_setと名前を付けたコンポーネントと接続されているようですから、それと同じ要領で縦方向の接続も行えばいいです。

投稿2020/08/22 08:42

keicha_hrs

総合スコア6768

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問