私は単純なレイアウトの4 TextView
があります。そのうち2つはテキストであらかじめ入力されており、数字は1から3までです。他の2つは、ユーザのタップであるListItem
に基づいて埋められます。彼らはテキストの異なる長さで満たされているので、大部分の時間は、テキストが重なります。上記のテキストビューにユーザーが入力した内容に基づいて、テキストビューの位置を変更するにはどうすればよいですか?
テキストが重なっていると、3番と4番の位置を画面上でさらに下に移動するにはどうすればよいですか?
コードは、以下に添付されています。それは構造のように思える
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/bildeAvGjenstand"
android:layout_width="150dp"
android:layout_height="150dp"
android:contentDescription="@string/bildeBesk"
android:layout_marginBottom="133dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="THIS IS PREFILLED"
android:textSize="35sp"
android:layout_above="@+id/gjenstand"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/gjenstand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="30sp"
android:visibility="visible"
android:layout_above="@+id/bildeAvGjenstand"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="24dp" />
<TextView
android:id="@+id/gjoremaal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="" <!-- I want this text view to change position -->
android:visibility="visible"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView3" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" <!-- I want this text view to change position -->
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="THIS IS PREFILLED"
android:textSize="35sp" />
重複すると、どういう意味ですか? – JediBurrell
ユーザーが特定のリストアイテムをタップしたときに入力されるテキストが、あらかじめ入力されたテキストを上書きするため、テキストが判読できなくなることを意味します。 –