TextField 与另一个 TextField 重叠 - Android
TextField overlapse another TextField - Android
我有一个包含电影类型的文本字段和另一个包含电影描述的文本字段。说明设置在具有固定大小的电影缩略图下方,类型在缩略图的右侧。问题是类型可能太长以适应 space i 保留器并与描述重叠。我需要将描述放在 thumbs AND genres 下方,或者可能是另一种防止重叠的方式。
film_information.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:layout_marginTop="2dp"
android:layout_marginLeft="2dp"
android:layout_width="110dp"
android:layout_height="149dp"
android:id="@+id/thumb_detail"
android:layout_alignParentTop="true"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginLeft="5dp"
android:id="@+id/titolo"
tools:text="Main Title"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_marginTop="2dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/release_date"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:layout_below="@+id/titolo"
tools:text="Data rilascio"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:id="@+id/author"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/release_date"
tools:text="autore"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:id="@+id/voto"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/author"
tools:text="Voto"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/durata"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/voto"
tools:text="Durata"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:id="@+id/generi"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/durata"
tools:text="Genere"
android:layout_marginLeft="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/titDesc"
android:layout_below="@+id/thumb_detail"
android:layout_marginTop="3dp"
tools:text="Descrizione"
android:textSize="18dp"
android:layout_marginLeft="2dp"
android:textColor="#000000"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/descr"
android:layout_marginLeft="2dp"
android:layout_below="@+id/titDesc"
android:layout_marginTop="2dp"
/>
</RelativeLayout>
把你的Layout
换成下面的Layout
可能对你有帮助
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rl1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/thumb_detail"
android:layout_width="110dp"
android:layout_height="149dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp" />
<TextView
android:id="@+id/titolo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
android:textAppearance="?android:attr/textAppearanceLarge"
tools:text="Main Title" />
<TextView
android:id="@+id/release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/titolo"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Data rilascio" />
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/release_date"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="autore" />
<TextView
android:id="@+id/voto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/author"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Voto" />
<TextView
android:id="@+id/durata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/voto"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Durata" />
<TextView
android:id="@+id/generi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/durata"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Genere" />
</RelativeLayout>
<TextView
android:id="@+id/titDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl1"
android:layout_marginLeft="2dp"
android:layout_marginTop="3dp"
android:textColor="#000000"
android:textSize="18dp"
tools:text="Descrizione" />
<TextView
android:id="@+id/descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/titDesc"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp" />
</RelativeLayout>
我有一个包含电影类型的文本字段和另一个包含电影描述的文本字段。说明设置在具有固定大小的电影缩略图下方,类型在缩略图的右侧。问题是类型可能太长以适应 space i 保留器并与描述重叠。我需要将描述放在 thumbs AND genres 下方,或者可能是另一种防止重叠的方式。
film_information.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:layout_marginTop="2dp"
android:layout_marginLeft="2dp"
android:layout_width="110dp"
android:layout_height="149dp"
android:id="@+id/thumb_detail"
android:layout_alignParentTop="true"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginLeft="5dp"
android:id="@+id/titolo"
tools:text="Main Title"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_marginTop="2dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/release_date"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:layout_below="@+id/titolo"
tools:text="Data rilascio"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:id="@+id/author"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/release_date"
tools:text="autore"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:id="@+id/voto"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/author"
tools:text="Voto"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/durata"
android:layout_marginTop="2dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/voto"
tools:text="Durata"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:id="@+id/generi"
android:layout_toRightOf="@+id/thumb_detail"
android:layout_below="@+id/durata"
tools:text="Genere"
android:layout_marginLeft="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/titDesc"
android:layout_below="@+id/thumb_detail"
android:layout_marginTop="3dp"
tools:text="Descrizione"
android:textSize="18dp"
android:layout_marginLeft="2dp"
android:textColor="#000000"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/descr"
android:layout_marginLeft="2dp"
android:layout_below="@+id/titDesc"
android:layout_marginTop="2dp"
/>
</RelativeLayout>
把你的Layout
换成下面的Layout
可能对你有帮助
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rl1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/thumb_detail"
android:layout_width="110dp"
android:layout_height="149dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp" />
<TextView
android:id="@+id/titolo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
android:textAppearance="?android:attr/textAppearanceLarge"
tools:text="Main Title" />
<TextView
android:id="@+id/release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/titolo"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Data rilascio" />
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/release_date"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="autore" />
<TextView
android:id="@+id/voto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/author"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Voto" />
<TextView
android:id="@+id/durata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/voto"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Durata" />
<TextView
android:id="@+id/generi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/durata"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/thumb_detail"
tools:text="Genere" />
</RelativeLayout>
<TextView
android:id="@+id/titDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl1"
android:layout_marginLeft="2dp"
android:layout_marginTop="3dp"
android:textColor="#000000"
android:textSize="18dp"
tools:text="Descrizione" />
<TextView
android:id="@+id/descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/titDesc"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp" />
</RelativeLayout>