layout.xmlКак центрировать выровнять 2 вида?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/viewPost"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="14dp"
android:background="@color/bg_blue"
android:gravity="center" >
<ImageView
android:id="@+id/ic_viewPost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_view" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/ic_viewPost"
android:gravity="center"
android:text="View post"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/socialShare"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="14dp"
android:background="@color/bg_light_grey"
android:gravity="center" >
<ImageView
android:id="@+id/ic_socialShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_share_post" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/ic_socialShare"
android:gravity="center"
android:text="Share with others"
android:textColor="@color/text_dark_grey"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
В графической компоновки:
На реальном устройстве:
В графическом макете он выглядит так, как я хотел, но на самом устройстве его совсем другое.
В 1-й относительной компоновке ImageView и TextView не выровнены.
Во 2-й относительной компоновке это выглядит так, как TextView снизу выравнивается с ImageView.
Thank you.