Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listview won't 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 listview takes only about a quarter of the linear layout remaining height.

As an experience I tried to use it alone (removing the textview and the linear layout) and it stretches as expected.

Might be stupid but cannot figure it out ...

like image 487
Sebastien FERRAND Avatar asked Feb 11 '26 19:02

Sebastien FERRAND


1 Answers

Add items in listview it will increase and scroll by default and make it wrap_content.

What is your exact problem? Question is not so clear.

like image 92
Neha Agarwal Avatar answered Feb 13 '26 08:02

Neha Agarwal