PCスペック
Windows7 64bit
メモリ 8GB
プロセッサ Intel Core i7-3610
Android Studio 3.4
アプリの画面で、CSVで読み込んだデータを表示する上部に、文字入力するためのEditextとButtonを追加したいです。(とりあえずButtonを押すと、EditTextで打ち込んだ文字がそのまま表示される機能をがあれば良い)
しかし、layoutファイルの書き方が正しくないせいで、現段階ではこのように表示されてしまいます。
理想は、EditextとButtonが画面の一番上で中央に表示され、その下に、CSVで読み込んだデータ類(ここではItem1だとかのリスト)を画面いっぱいに並べる形に仕上げたいです。。
xml
1<?xml version="1.0" encoding="utf-8"?> 2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent"> 7 8 9 <TextView 10 android:id="@+id/text_view" 11 android:layout_width="wrap_content" 12 android:layout_height="wrap_content" 13 android:gravity="center" 14 android:textSize="30sp" 15 app:layout_constraintBottom_toBottomOf="parent" 16 app:layout_constraintHorizontal_bias="0.6" 17 app:layout_constraintLeft_toLeftOf="parent" 18 app:layout_constraintRight_toRightOf="parent" 19 app:layout_constraintTop_toTopOf="parent" 20 app:layout_constraintVertical_bias="0.15" /> 21 22 <EditText 23 android:id="@+id/edit_text" 24 android:layout_width="wrap_content" 25 android:layout_height="wrap_content" 26 android:autofillHints="@string/hint" 27 android:background="#ffffff" 28 android:hint="@string/hint" 29 android:inputType="text" 30 app:layout_constraintBottom_toBottomOf="parent" 31 app:layout_constraintLeft_toLeftOf="parent" 32 app:layout_constraintRight_toRightOf="parent" 33 app:layout_constraintTop_toTopOf="parent" 34 app:layout_constraintVertical_bias="0.3" /> 35 36 <Button 37 android:id="@+id/button" 38 android:layout_width="wrap_content" 39 android:layout_height="wrap_content" 40 android:text="@string/button" 41 app:layout_constraintBottom_toBottomOf="parent" 42 app:layout_constraintLeft_toLeftOf="parent" 43 app:layout_constraintRight_toRightOf="parent" 44 app:layout_constraintTop_toTopOf="parent" 45 app:layout_constraintVertical_bias="0.45" /> 46 47 <ListView 48 android:id="@+id/list_view1" 49 android:layout_width="0dp" 50 android:layout_height="match_parent" 51 android:layout_weight="1"></ListView> 52 53 <ListView 54 android:id="@+id/list_view2" 55 android:layout_width="0dp" 56 android:layout_height="match_parent" 57 android:layout_weight="1"></ListView> 58 59 <ListView 60 android:id="@+id/list_view3" 61 android:layout_width="0dp" 62 android:layout_height="match_parent" 63 android:layout_weight="1"></ListView> 64 65 66</LinearLayout> 67 68
現状では、<LinearLayout>で囲っているだけなので、この表示のされ方になってしまったのですが、これを直す方法はどのようなものが考えられますでしょうか??
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。