The last element of my ListView is cut off

2

Finally I only added the line I put here below to the listview and it was solved, thanks for the answers!

  

android: paddingBottom="attr / actionBarSize" / >

Good the problem is that my listview shows me the list, but the last element of the list does not show it complete, if not that the last one is cut,:

As you can see in the picture Luis does not appear completely.

Lisview:'<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ListView
        android:id="@+id/LvListaUsuarios"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />


</LinearLayout>

Adaptador:'public class AdaptadorListaUsuarios extends ArrayAdapter<Usuario>{

    public AdaptadorListaUsuarios(Context context, ArrayList<Usuario> usuarios) {
        super(context, 0, usuarios);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.item_lista_usuarios,parent,false);

        }

        TextView nombre = (TextView) convertView.findViewById(R.id.tvUsuarioLista);

        TextView correo = (TextView) convertView.findViewById(R.id.tvCorreoLista);

        Usuario usuario = getItem(position);


    nombre.setText(usuario.getNombreUsuario());
    correo.setText(usuario.getEmail());
    
asked by jlgf 27.01.2017 в 14:48
source

3 answers

1

Change the values of the properties of your ListView android:layout_height and android:layout_weight with values wrap_content :

<ListView
    android:id="@+id/LvListaUsuarios"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

You can choose to use match_parent but in this case, even if you do not have enough elements your ListView will be shown with the full height.

  <ListView
        android:id="@+id/LvListaUsuarios"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    
answered by 27.01.2017 в 16:07
0

Try adding XML to Space , for example:

<ListView
    android:id="@+id/LvListaUsuarios"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" />

<Space
   android:layout_width="match_parent"
   android:layout_height="50dp" />

You can modify layout_height according to your need.

    
answered by 27.01.2017 в 15:02
0

Simple and simple answer, if your screen only shows a list then do not complicate yourself and say it in the following way.

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LvListaUsuarios"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
answered by 27.01.2017 в 16:14