###前提・実現したいこと
初めて質問します。
独学でAndroidstudioを勉強しているプログラミング初心者です。
「Androidアプリを作ろう[AndroidStudio2.1対応版]」という電子書籍を見ながら練習をしております。
左端のtextViewと右端のbuttonを基準に中央にeditTextを配置するという事をしたいのですが、書籍に記述されている項目が見当たらず行き詰ってしまいました。
###発生している問題・エラーメッセージ
現在activity_main.xmlのDesignモードの使い方を簡単なレイアウトを作りながら学んでいますが、
書籍に書かれているプロパティ内の「layout:alignComponent」という項目が見当たりません。
AndroidStudioのバージョンは2.3.2ですが、バージョンの違いが原因でしょうか?
「layout:alignComponent」に変わる項目はありますか?
###試したこと
プロパティ内項目layout_alignLeftなどに値を入れてみましたが、
他のViewの上にかぶって横幅いっぱいに配置されてしまいます。
textViewの右端とbuttonの左端を基準に配置したいです↓
|textView||editText||button|
###補足情報(言語/FW/ツール等のバージョンなど)
AndroidStudio バージョン2.3.2
OS Windows 10 pro
現在のコードはこんな感じです。
Edittextにlayout_to〇〇of= という項目に値を入れたら、
見た目は理想に近づきました。
(プログラムとして正しいかは分かりません・・・)
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="50dp" android:gravity="center_vertical" android:text="名前" android:textSize="25sp" /> <Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_alignParentRight="true" android:text="入力" /> <EditText android:id="@+id/editText3" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_toLeftOf="@+id/button5" android:layout_toRightOf="@+id/textView3" android:ems="10" android:inputType="textPersonName" /> </RelativeLayout>
回答3件
あなたの回答
tips
プレビュー