У меня есть просмотрщик с прикрепленным к нему сетевым менеджером. Столбцы расположены правильно, но строки перепутаны. Кажется, что пространство между каждой строкой меняется каждый раз, когда я прокручиваю вверх и вниз. ![Picture showing the problem](https://i.stack.imgur.com/PcmY2.png)
Здесь я настраиваю представление переработчика и менеджер компоновки сетки:
var inflater = view.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
var rootLayout = view.findViewById<LinearLayout>(R.id.ll_linear)
var heroListView = inflater.inflate(R.layout.hero_list_tab_card, rootLayout, true)
//get the recycler view
var heroListRv = heroListView.findViewById<RecyclerView>(R.id.rv_heroes)
heroListRv.layoutManager = GridLayoutManager(view.context, 4)
Здесь hero_list_tab_card:
<?xml version="2.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/tv_primary_attribute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:textAllCaps="true"
android:textColor="@color/colorTextWhite"
android:text="@string/test"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<ImageView
android:layout_width="60dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/tv_primary_attribute"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/dotabuddy_icon"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_heroes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
app:layout_constraintTop_toBottomOf="@id/tv_primary_attribute"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Вот фактические элементы героя, которые заполнены в сетке:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iv_heroimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dotabuddy_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/tv_heroname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorTextWhite"
android:text="@string/test"
app:layout_constraintTop_toBottomOf="@id/iv_heroimage"
app:layout_constraintStart_toStartOf="@id/iv_heroimage"
app:layout_constraintEnd_toEndOf="@id/iv_heroimage"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Пожалуйста, дайте мне знать, если вы хотите, чтобы я опубликовал любую другую информацию. Любая помощь будет принята с благодарностью.
Редактировать: для пояснения Я говорю об огромном разрыве между 4-й строкой и 5
.