Android Элементы ListView слишком большие, не знаю почему - PullRequest
0 голосов
/ 01 мая 2020

Я тестировал свое приложение и обнаружил эту ошибку. Вот как выглядит пользовательский интерфейс

Работает на Android 5.1, но в более высоких версиях этого не происходит ... это полный XML код XML код

исходный код на данный момент:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:minHeight="80dp"
    android:layout_height="wrap_content"
    android:background="?attr/rowTareaBackGround">

    <TextView
        android:id="@+id/tituloTarea"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:textSize="30sp"
        android:padding="8dp"/>

    <Button
        android:id="@+id/btnEliminarTarea"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:background="@drawable/papelera"
        android:scaleX="0.5"
        android:scaleY="0.5" />

</LinearLayout>

1 Ответ

0 голосов
/ 03 мая 2020

Измените текстовое представление android:layout_weight="4" на android:layout_weight="1"

и удалите android:layout_weight="1" из кнопки

Измените свой код в соответствии с этим

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:background="@android:color/white"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/tituloTarea"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@id/btnEliminarTarea"
        android:padding="8dp"
        android:textSize="30sp" />

    <Button
        android:id="@+id/btnEliminarTarea"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentRight="true"
        android:background="@mipmap/ic_launcher"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:scaleX="0.5"
        android:scaleY="0.5" />

</RelativeLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...