Разрешить перекрытие элементов Android Gridview - PullRequest
0 голосов
/ 25 марта 2020

У меня есть класс c GridView с фиксированным количеством столбцов, где ширина каждого столбца рассчитывается на основе всей ширины вида. Каждый элемент сетки имеет небольшое цветовое представление, и не каждый элемент имеет субтитры.

Иногда субтитры шире столбца и поэтому не полностью видны (обрезаны). Можно ли каким-либо образом разрешить TextView go для следующего элемента?

GridView:

<GridView
    android:id="@+id/legend_grid_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:listSelector="@android:color/transparent"
    android:numColumns="12"
    android:layout_margin="12dp"
    android:gravity="center"
    android:orientation="horizontal"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/title"
    android:stretchMode="columnWidth" />

GridItem:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <View
        android:id="@+id/legend_color"
        style="@style/LegendColorStyle"
        android:contentDescription="@null" />

    <TextView
        android:id="@+id/legend_text"
        style="@style/LegendTextStyle"
        android:layout_below="@id/legend_color" />
</RelativeLayout>

Это приводит к:

______________________
|___|___|___|___|___|
|lor     ips     um | 

Желаемый результат:

______________________
|___|___|___|___|___|
|lorem   ipsum   um | 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...