How to prevent the text of a ListView from leaving the frame?

1

basically my problem is described in the following image.

What would be his would be that each element of the ListView was according to a fixed size, and in the case that it will surpass that it was written below. Step part of the application code

fragment_facturacion.xml

<TextView
    android:id="@+id/tvFacturacion1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAlignment="center"
    android:textColor="@color/font_color"
    android:textSize="30dp"
    android:paddingTop="20dp"
    android:text="Facturación" />

<TextView
    android:id="@+id/textView5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="20dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:textSize="20dp"
    android:layout_marginTop="5dp"
    android:textColor="@color/subfont_color"
    android:text="Aquí podrá visualizar, si tiene, los ultimos cargos que haya hecho en el club"
    />

<ListView
    android:id="@+id/mens_listView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentStart="true"
    android:padding="20dp" />

Now the xml of the ListView list. item_lista.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:id="@+id/tv_lista1"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:inputType="date"
    android:padding="5sp"
    android:gravity="center"
    android:textColor="@color/colorWhite"
    android:textSize="20sp"
    android:layout_weight="1"
    android:text="Fecha" />

<TextView
    android:id="@+id/tv_lista2"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:textSize="20sp"
    android:padding="5sp"
    android:gravity="center"
    android:layout_weight="2"
    android:textColor="@color/colorWhite"
    android:text="Concepto" />

<TextView
    android:id="@+id/tv_lista3"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:textSize="20sp"
    android:padding="5sp"
    android:gravity="center"
    android:textColor="@color/colorWhite"
    android:layout_weight="1"
    android:inputType="number"
    android:text="Precio" />

I do not think any more files are necessary, if necessary leave a comment and edit the question.

Greetings, thank you.

    
asked by Ivan 04.05.2017 в 10:17
source

1 answer

-1

The first thing I've noticed is that you have some textSize with dp instead of with sp.

For example:

<TextView
android:id="@+id/tvFacturacion1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@color/font_color"
android:textSize="30dp"
android:paddingTop="20dp"
android:text="Facturación" />

On the other hand, take a look at this link:

link

It explains how to specify the sizes of texts according to the size of the screen on which your application is being viewed.

I hope I could have helped you.

    
answered by 28.06.2017 в 10:52