Listview Adapter problems with whitespace

1

I am creating a listView with adpater and I have a problem, I needed to add an image in the middle of the list to be in the direct corner, this image is just an arrow. how can I solve it, it takes up all the screen space even though I define the size of the image and that is for it to be in the direct corner.

segue XML  lista:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="15dp"
    android:background="@drawable/color_list">



    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="UselessParent">



        <TextView
            android:text="@string/textview"
            android:layout_width="match_parent"
            android:textSize="18sp"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:id="@+id/txtVencimento"
            android:layout_marginLeft="10dp"
            tools:ignore="RtlHardcoded" />



        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtPagamento"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtNumeDoc"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtHistorico"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            app:srcCompat="@drawable/caratrblack"
            android:id="@+id/imageView3"
            tools:ignore="ContentDescription,RtlHardcoded"
            android:layout_marginRight="15dp" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtOrigem"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />


        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtValoresDesconto"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtMultaJuros"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />

        <TextView
            android:text="TextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtTotal"
            tools:ignore="HardcodedText,RtlHardcoded"
            android:layout_marginLeft="10dp"
            android:elevation="50dp"
            tools:targetApi="lollipop" />




    </LinearLayout>

</RelativeLayout>
    
asked by anonymous 09.12.2016 / 17:23

1 answer

1
 <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout
    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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:ignore="UselessParent">

<LinearLayout
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="wrap_content">

    <TextView
        android:text="teste"
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:textSize="18sp"
        android:textStyle="bold"
        android:layout_height="wrap_content"
        android:id="@+id/txtVencimento"
        android:layout_marginLeft="10dp"
        tools:ignore="RtlHardcoded" />


    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        app:srcCompat="@drawable/user"
        android:id="@+id/imageView3"
        tools:ignore="ContentDescription,RtlHardcoded"
        android:layout_marginRight="15dp" />

    </LinearLayout>



    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtPagamento"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtNumeDoc"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtHistorico"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtOrigem"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />


    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtValoresDesconto"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtMultaJuros"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />

    <TextView
        android:text="TextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txtTotal"
        tools:ignore="HardcodedText,RtlHardcoded"
        android:layout_marginLeft="10dp"
        android:elevation="50dp"
        tools:targetApi="lollipop" />


</LinearLayout>

This should solve your problem. I removed Relative and am using LinearLayout.

You needed to put the image inside another Linear horizontally.

It should have other means, so I found it easier.

    
09.12.2016 / 19:25