Layout below expandable view is not visible?

285 views Asked by At
<LinearLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:id="@+id/linearLayoutUser"
  >

<!-- TODO: Update blank fragment layout -->

<ExpandableListView
    android:id="@+id/expandableListView"

    android:layout_width="match_parent"
    android:layout_alignParentTop="true"
    android:groupIndicator="@null"
    android:layout_gravity="left|top"
    android:layout_weight="1"



    />

//only above code is visible //Below this code is not visible //below is details information inside scrollview

    <ScrollView

        android:layout_width="match_parent"


        android:layout_gravity="center"
        android:layout_weight="1"
        >
  </scrollView>

</LinearLayout>
3

There are 3 answers

0
IntelliJ Amiya On BEST ANSWER

Set proper android:layout_weight and android:layout_height value .

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/linearLayoutUser">

          <ExpandableListView
            android:id="@+id/expandableListView"
            android:layout_height="0dp"
            android:layout_width="match_parent"
            android:layout_alignParentTop="true"
            android:groupIndicator="@null"
            android:layout_gravity="left|top"
            android:layout_weight="1"/>    

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:fillViewport="true">
       // your work
   </ScrollView>
</LinearLayout>
0
Sneha Sarkar On

Change your xml to:

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

    <ExpandableListView
        android:id="@+id/expandableListView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_gravity="left|top"
        android:layout_weight="1"
        android:groupIndicator="@null" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">

        <!--Scroll view with only one direct child-->

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

            <!--Do your work here-->

        </LinearLayout>
    </ScrollView>

</LinearLayout>
0
Divya Jain On

There are two properties which is used for weight. 1) layout_weight
2) weightsum

In a container/parent (a lineaLayout) You should set a layout_weightsum which is the total amount of weights you are using inside this layout.

Here,you have linearlayout with two items, and both items have to have the same height.

You will set a sum of 2 and for each layout a weight of 1 for each child layout.

Hope it will help!

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

    <ExpandableListView
        android:id="@+id/expandableListView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_gravity="left|top"
        android:layout_weight="1"
        android:groupIndicator="@null" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:layout_weight="1">

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

            <!--Add your other part which you want to show in ScrollView-->

        </LinearLayout>
    </ScrollView>
</LinearLayout>