Custom ListView occupying 100% of screen

1

I created a Custom Listview with some items but as you can see in the image below there is an "empty space" on the screen.

I would like to know how to make the items occupy all the remaining space on the screen.

Menu.javacode:

publicclassMenuextendsActivity{privateList<MenuItensAndIcons>menuitens=newArrayList<MenuItensAndIcons>();@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.menulistview);CriandoItensMenu();CriandoListView();finalUsuarioLogadousuariologado=(UsuarioLogado)getApplicationContext();getActionBar().setTitle(usuariologado.getUsuariologado());getActionBar().setIcon(newColorDrawable(getResources().getColor(android.R.color.transparent)));}privatevoidCriandoItensMenu(){menuitens.add(newMenuItensAndIcons("Cadastrar", R.drawable.add));
    menuitens.add(new MenuItensAndIcons("Meus Cadastros", R.drawable.consulta));
    menuitens.add(new MenuItensAndIcons("Perfil", R.drawable.neutro));
    menuitens.add(new MenuItensAndIcons("Mapa", R.drawable.mapa));
    menuitens.add(new MenuItensAndIcons("Consulta Avançada", R.drawable.consulta));

}

private void CriandoListView() {

    ArrayAdapter<MenuItensAndIcons> arrayadapter = new MyListAdapter();
    ListView listamenu = (ListView)findViewById(R.id.menulist);
    listamenu.setAdapter(arrayadapter);
}

private class MyListAdapter extends ArrayAdapter<MenuItensAndIcons>{
    public MyListAdapter(){

        super(Menu.this, R.layout.item_view, menuitens);

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View itemview = convertView;

        if(itemview == null){
            itemview = getLayoutInflater().inflate(R.layout.item_view, parent, false);

        }

        //achar o item especifico

        MenuItensAndIcons itematual = menuitens.get(position);

        //preenche os dados do listview

        ImageView imageview = (ImageView)itemview.findViewById(R.id.ItemIcon);
        imageview.setImageResource(itematual.getIconeMenu());

        TextView Textitem = (TextView)itemview.findViewById(R.id.item_TextItem);
        Textitem.setText(""+itematual.getNomeMenu());

        return itemview;
    }


}

Menulistview.xml code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/menulist"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </ListView>

</LinearLayout>

Item_view.xml code:

<?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="match_parent" >

    <ImageView
        android:id="@+id/ItemIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/add" />

    <TextView
        android:id="@+id/item_TextItem"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/ItemIcon"
        android:layout_marginBottom="16dp"
        android:layout_marginLeft="15dp"
        android:layout_toRightOf="@+id/ItemIcon"
        android:text="Text Aqui"
        android:textColor="@android:color/white" />

</RelativeLayout>
    
asked by anonymous 31.01.2015 / 06:07

1 answer

0

Hello

The only solution that comes to mind is to increase the size of the ballot. However, with a little research I came across a similar case that might work for you!

Go to your AndroidManifest.xml file and add the following code:

 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

I hope it helps!

( Reference )

    
31.01.2015 / 19:17