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

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

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

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

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

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Q&A

解決済

2回答

889閲覧

Android,ConstantLayout %指定

harumi

総合スコア407

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

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

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

0グッド

0クリップ

投稿2019/02/13 04:36

Androidのレイアウトで、%指定を行いたいのですが、うまく指定することができません。
イメージとしては画像のように2つのTextViewを画面トップから75%のいちに配置したいと考えております。

イメージ説明

xml

TextViewの制約をつけている部分はこのように設定しているのですが、2つ目のTextViewが上に張り付いた形になってしまっています

xml

1<TextView 2 android:id="@+id/license_agreement" 3 android:text="@string/agreement_licenseagreement" 4 android:autoSizeMinTextSize="@dimen/myTextSizeT3" 5 android:layout_width="wrap_content" 6 android:textColor="@color/colorC6" 7 android:layout_height="wrap_content" 8 android:clickable="true" 9 app:layout_constraintTop_toTopOf="parent" 10 app:layout_constraintBottom_toBottomOf="parent" 11 app:layout_constraintVertical_bias="0.75" 12 tools:ignore="MissingConstraints" android:layout_marginStart="16dp" 13 app:layout_constraintStart_toStartOf="parent" 14 /> 15 <TextView 16 android:text="@string/agreement_adaptation" 17 android:autoSizeMinTextSize="@dimen/myTextSizeT3" 18 android:layout_width="wrap_content" 19 android:textColor="@color/colorC6" 20 android:layout_height="wrap_content" 21 android:id="@+id/textView" 22 tools:layout_editor_absoluteY="534dp" 23 tools:ignore="MissingConstraints" 24 app:layout_constraintVertical_bias="0.75" 25 app:layout_constraintStart_toEndOf="@+id/license_agreement"/>

どこが間違っているのでしょうか?

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

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

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

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

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

guest

回答2

0

@dimen や @color など不明な点は削除・置き換えましたが, 以下のコードで並べられていると思います.
一つ目の TextView(id:license_agreement) がご希望の位置にあるのなら, そこから上端と左端を設定すれば良いかと思います.

XML

1 <TextView 2 android:id="@+id/license_agreement" 3 android:text="agreement_licenseagreement" 4 android:layout_width="wrap_content" 5 android:layout_height="wrap_content" 6 app:layout_constraintTop_toTopOf="parent" 7 app:layout_constraintBottom_toBottomOf="parent" 8 app:layout_constraintVertical_bias="0.75" 9 app:layout_constraintStart_toStartOf="parent" 10 android:layout_marginStart="16dp"/> 11 <TextView 12 android:id="@+id/textView" 13 android:text="agreement_adaptation" 14 android:layout_width="wrap_content" 15 android:layout_height="wrap_content" 16 app:layout_constraintTop_toTopOf="@id/license_agreement" 17 app:layout_constraintStart_toEndOf="@id/license_agreement"/>

投稿2019/02/13 05:04

jimbe

総合スコア12632

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

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

0

自己解決

このような感じでうまく適応することができまた

<TextView android:id="@+id/license_agreement" android:text="@string/agreement_licenseagreement" android:autoSizeMinTextSize="@dimen/myTextSizeT3" android:layout_width="wrap_content" android:textColor="@color/colorC6" android:layout_height="wrap_content" android:clickable="true" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintVertical_bias="0.75" tools:ignore="MissingConstraints" app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toStartOf="@+id/textView"/> <TextView android:text="@string/agreement_adaptation" android:autoSizeMinTextSize="@dimen/myTextSizeT3" android:layout_width="wrap_content" android:textColor="@color/colorC6" android:layout_height="16dp" android:id="@+id/textView" tools:ignore="MissingConstraints" app:layout_constraintStart_toEndOf="@+id/license_agreement" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.75"/>

投稿2019/02/13 05:01

harumi

総合スコア407

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問