Я хочу выровнять линейное расположение по горизонтали, и у меня в макете есть родительский объект RelativeLayout.Я должен выровнять свой макет, используя относительный макет. Я не хочу использовать макет Constraint прямо сейчас.Я сосредотачиваюсь на том, насколько гибок относительный макет, чтобы я мог получить пользу от того, что у него есть.когда я использую android: layout_toEndOf = "@ + id / product_img" , чтобы выровнять, так что теперь мой product_img имеет маржу top 20 dp, но когда я установил линейный макет на android: layout_toEndOf = "@ + id / product_img " он только устанавливает его в конец, но опять же мне нужно установить верхнее поле 20dp для моего нового макета.почему я снова и снова устанавливаю отступ в каждом макете?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_10sdp"
android:background="@drawable/round_corner_white_alrt_box"
android:orientation="vertical">
<ImageView
android:id="@+id/product_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="@dimen/_20sdp"
android:src="@mipmap/ic_launcher"
/>
<ImageView
android:id="@+id/cross_btn"
android:layout_width="@dimen/_16sdp"
android:layout_height="@dimen/_16sdp"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_x"
/>
<LinearLayout
android:id="@+id/product_detail_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_5sdp"
android:layout_toEndOf="@+id/product_img"
android:orientation="vertical"
>
<TextView
android:id="@+id/price_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/product_img"
android:fontFamily="@font/montserrat_regular"
android:text="@string/how_many"
android:textColor="@color/green"
android:textSize="@dimen/_11sdp" />
<TextView
android:id="@+id/product_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/product_img"
android:fontFamily="@font/montserrat_regular"
android:text="@string/how_many"
android:textColor="@color/black"
android:textSize="@dimen/_11sdp" />
<TextView
android:id="@+id/product_quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/product_detail"
android:layout_toRightOf="@+id/product_img"
android:fontFamily="@font/montserrat_regular"
android:text="@string/how_many"
android:textColor="@color/colorGrey"
android:textSize="@dimen/_11sdp" />
</LinearLayout>
