У меня есть изображение и текстовое изображение внутри относительной компоновки. Изображение и текстовое изображение занимают 50% ширины экрана. Как я могу центрировать изображение и текстовое изображение? Я пробовал много методов, и я не знаю, что я делаю неправильно ...Центр ImageView в относительной компоновке
Вот мой код:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="50"
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textViewEventImage"
android:adjustViewBounds="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/eventNameBackground"
android:id="@+id/textViewEventName"
android:textColor="@android:color/white"
android:textSize="15sp"/>
</RelativeLayout>
</LinearLayout>
ли вы хотите, чтобы ваше изображение будет в центре экрана? –