независимо от того, что я делаю в своем дизайне, я хочу центрировать то, что я написал, с фотографиями, но я не могу сделать дизайн, мне интересно, где я ошибаюсь, я учусь новому и пытался сделать дизайн, как на фото Я создам остальные, используя вид переработчика и вид карточки. Достаточно объяснений, надеюсь, я не хочу вас запутать
<androidx.cardview.widget.CardView 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 = "match_parent">
<LinearLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:orientation = "horizontal">
<ImageView
android:id = "@+id/imageView6"
android:layout_width = "60dp"
android:layout_height = "60dp"
android:contentDescription = "TODO" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_weight = "1"
android:orientation = "vertical">
<TextView
android:id = "@+id/textView4"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:text = "text" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<TextView
android:id = "@+id/textView5"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:text = "Date" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_weight = "1"
android:orientation = "horizontal">
<TextView
android:id = "@+id/textView3"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:text = "text" />
</LinearLayout>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal">
<ImageView
android:id = "@+id/imageView7"
android:layout_width = "60dp"
android:layout_height = "60dp"" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
@Николас, я хочу сделать дизайн на изображении
Вы пытались установить свойство гравитации для текстовых представлений по центру?
Разделил центральную часть на два линейных макета. Также добавлен android:gravity = "center|bottom"
к TextView
, который содержит дату.
<androidx.cardview.widget.CardView 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 = "match_parent">
<LinearLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:orientation = "horizontal">
<ImageView
android:id = "@+id/imageView6"
android:layout_width = "60dp"
android:layout_height = "60dp"
android:contentDescription = "TODO" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical">
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal">
<TextView
android:id = "@+id/textView4"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:text = "text" />
<TextView
android:id = "@+id/textView3"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:text = "text" />
</LinearLayout>
<TextView
android:id = "@+id/textView5"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:gravity = "center|bottom"
android:text = "Date" />
</LinearLayout>
<ImageView
android:id = "@+id/imageView7"
android:layout_width = "60dp"
android:layout_height = "60dp" />
</LinearLayout> </androidx.cardview.widget.CardView>
Вот как это выглядит. Я добавил несколько цветов, чтобы было легче увидеть, где макеты начинаются и заканчиваются. Цвета не являются частью xml.
Непонятно, чего вы хотите добиться, а что не так.