Listview occupy the entire screen

Asked

Viewed 674 times

0

I have this listview

main.xml

 <ListView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/praias"
    android:layout_above="@+id/adView"
    />

inserir a descrição da imagem aqui

I was Wanting the item of this listview to occupy the full width , it is already fillparent so I think it should be occupying the whole screen ne. How do I not get these blank spaces on the edges

xml items.

<?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:background="#ffffff"
    android:orientation="vertical">

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Bertioga"
    android:textColor="#000000"
    android:gravity="center"
    android:id="@+id/nomePraia"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" />

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/fotoPraia"
    android:layout_below="@+id/nomePraia"
    android:layout_centerHorizontal="true"
    android:layout_above="@+id/bt" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:text="Coemçar a descrição ...."
    android:id="@+id/descricao"
    android:maxLength="400"
    android:textColor="#000000"
    android:layout_alignTop="@+id/btFavorito"
    android:layout_toEndOf="@+id/btFavorito"
    android:gravity="left"
    android:layout_toStartOf="@+id/bt"
    android:layout_toRightOf="@+id/btFavorito"
    android:layout_toLeftOf="@+id/bt" />

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/btVerMais"
        android:id="@+id/btVerMais"
        android:background="#fff"
        android:textColor="@color/wallet_link_text_light"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/btFavorito"

        android:background="@drawable/ic_action_favorite"
        android:layout_alignTop="@+id/bt"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/bt"
        android:background="@drawable/ic_action_overflow"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />
</RelativeLayout>

  • 1

    What about the layout of the items in this list? Put it also in the question, probably in it is the problem.

  • minutes I’ll put

1 answer

1


Try this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
tools:context="${relativePackage}.${activityClass}" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world" />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="0dp" >

    <ListView
        android:id="@+id/listViewIntervalDetails"
        android:layout_width="fill_parent"
        android:layout_height="150dp"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/checknormal"
        android:cacheColorHint="#00000000"
        android:divider="#b5b5b5"
        android:dividerHeight="1dp"
        android:longClickable="true"
        android:padding="2dp" >
    </ListView>
</LinearLayout>

  • I don’t understand testing where

  • troca onde está seu listview por esse: <LinearLayout&#xA; android:layout_width="fill_parent"&#xA; android:layout_height="wrap_content"&#xA; android:layout_alignParentLeft="true"&#xA; android:layout_gravity="center_horizontal"&#xA; android:layout_marginTop="0dp" > ...continue

Browser other questions tagged

You are not signed in. Login or sign up in order to post.