gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
Элементы RecycleView ДАЛЕКО ДРУГ ОТ ДРУГА : <?xml version="1.0" encoding="utf-8"?>…
- User
Элементы RecycleView ДАЛЕКО ДРУГ ОТ ДРУГА : <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" tools:ignore="MissingConstraints"> <ImageView android:id="@+id/cart_item_image_view" android:layout_width="80dp" android:layout_height="80dp" android:src="@drawable/food_1_1"/> <LinearLayout android:orientation="vertical" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:paddingHorizontal="16dp"> <TextView android:id="@+id/cart_item_name_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="16sp" android:textStyle="bold" android:text="Product Name"/> <TextView android:id="@+id/cart_item_price_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/colorAccent" android:text="Price: $9.99"/> <TextView android:id="@+id/cart_item_total_price_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/colorPrimary" android:text="Total price: $9.99"/> <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/cart_item_decrease_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-"/> <TextView android:id="@+id/cart_item_quantity_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingHorizontal="8dp" android:text="1"/> <Button android:id="@+id/cart_item_increase_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+"/></LinearLayout></LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> - Assistant
Это макет элемента списка для RecyclerView, в котором есть:
- ImageView для отображения изображения продукта;
- TextView для отображения названия продукта;
- TextView для отображения цены продукта;
- TextView для отображения общей стоимости продукта;
- Кнопки для увеличения и уменьшения количества продукта;
- Кнопка для удаления продукта из списка.
Все эти элементы расположены в LinearLayout-ах, которые находятся внутри ConstraintLayout. Каждый элемент списка занимает всю ширину экрана благодаря свойству layout_width="match_parent". Используется weight для LinearLayout, содержащего TextView-элементы, чтобы он занимал все оставшееся место на экране и текст всегда отображался на одном уровне.