Listview will not match_parent

Here is the XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffa500"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<LinearLayout
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <Button
        android:id="@+id/profile_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/essai_profil" />

    <Button
        android:id="@+id/portrait_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/icon_portrait" />

    <Button
        android:id="@+id/education_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/education_icon" />

    <Button
        android:id="@+id/skills_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/skill_icon" />

    <Button
        android:id="@+id/langue_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/map_icon" />

    <Button
        android:id="@+id/loisir_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/dice" />

    <Button
        android:id="@+id/contact_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/contact_icon" />
</LinearLayout>

<LinearLayout
    android:layout_width="50dp"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <Button
        android:id="@+id/bubble_1"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start" />

    <Button
        android:id="@+id/bubble_2"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />

    <Button
        android:id="@+id/bubble_3"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />

    <Button
        android:id="@+id/bubble_4"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />

    <Button
        android:id="@+id/bubble_5"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />

    <Button
        android:id="@+id/bubble_6"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />

    <Button
        android:id="@+id/bubble_7"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bubble_start"
        android:visibility="invisible" />
</LinearLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bubble_patched" >

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="@string/name"
        android:textColor="#996300"
        android:textSize="20sp"
        android:textStyle="bold" />

    <ListView
        android:id="@+id/lv_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/title" >
    </ListView>
</RelativeLayout>

The list only takes into account about a quarter of the remaining length of the linear layout.

As an experience, I tried to use it alone (deleting text and linear layouts), and it stretches as expected.

Maybe it's stupid, but can't figure it out ...

+3
source share
4 answers

It was all against the backdrop of the line layout "bubble_patched". Somehow it was cutting off on the fixed part ... just returned to the ninth table as a solution.

Thank you all

0
source

Add items to listviewit will increase and scroll by default and make it wrap_content.

What is your specific problem? The question is not so clear.

+2

- - , Ok:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DynamicListView" >

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

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="name"
            android:textColor="#996300"
            android:textSize="20sp"
            android:textStyle="bold" />

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

</RelativeLayout>
+1

You have a lot Buttonwith android:layout_height="100dp", they take all the heights in your mind . 14 Buttonwith a height of 100dp = height of 1400dp. And you also have margin_top, which gets extra height for your view.

+1
source

All Articles