Таким образом, вы можете понять мою точку зрения, вот изображение: Android XML выравнивать перекрывающийся текст
Таким образом, КОД (A) состоит в следующем:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:background="@drawable/image_bg">
<ImageView
android:id="@+id/product_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:src="@drawable/bag"
android:scaleType="fitXY"/>
</LinearLayout>
<TextView
android:id="@+id/title_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/thumbnail"
android:layout_toRightOf="@+id/thumbnail"
android:text="Title of product"
android:textColor="#040404"
android:textSize="15sp"
android:textStyle="bold"
android:typeface="sans"
android:lines="2"
android:gravity="left"
/>
<TextView
android:id="@+id/model_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title_product"
android:textColor="#343434"
android:textSize="10dip"
android:layout_marginTop="1dip"
android:layout_toRightOf="@+id/thumbnail"
android:text="Model..." />
<TextView
android:id="@+id/price_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/title_product"
android:gravity="right"
android:text="10,99€"
android:layout_marginRight="5dip"
android:textSize="13dip"
android:textColor="#10bcc9"
android:textStyle="bold"/>
</RelativeLayout>
И КОД (В):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:background="@drawable/image_bg">
<ImageView
android:id="@+id/product_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:src="@drawable/bag"
android:scaleType="fitXY"/>
</LinearLayout>
<TextView
android:id="@+id/title_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/thumbnail"
android:layout_toRightOf="@+id/thumbnail"
android:layout_toLeftOf="@+id/price_product"
android:maxLines="1"
android:text="Title of product"
android:textColor="#040404"
android:textSize="15sp"
android:textStyle="bold"
android:typeface="sans"
android:lines="2"
android:gravity="left"
/>
<TextView
android:id="@+id/model_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title_product"
android:textColor="#343434"
android:textSize="10dip"
android:layout_marginTop="1dip"
android:layout_toRightOf="@+id/thumbnail"
android:text="Model..." />
<TextView
android:id="@+id/price_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="10,99€"
android:layout_marginRight="5dip"
android:textSize="13dip"
android:textColor="#10bcc9"
android:textStyle="bold"/>
</RelativeLayout>
Как вы видите, «Титульный продукт» перекрывает «Цена». Каков наилучший подход для достижения того, что я хочу в первом изображении?
Похоже, вы должны просто поменять местами «модель» и «цена» в версии B. В качестве альтернативы просто добавьте 'toLeftOf' (к названию« относительно цены ») в версии A. –