-1

I created three child View. View A, View B, and View C. View A contains three Edit Text, and View B contains ListView. If I click the Edit Text then I want to scroll all the layout it's working well, but all of the views have fixed size.

The problem is that if the View B list view element is increased, then View C is going down and not showing View C.

enter image description here

<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="#21252E"
    android:orientation="vertical"
    android:padding="10dp"
    tools:context="all_fregment_here.Order_freg">
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    >

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

      <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:orientation="vertical"
          android:layout_weight="2.80"
          >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="6">


        <ProgressBar
            android:id="@+id/history_progress_id"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".70" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="2.80"
            android:paddingLeft="5dp"
            android:text="ORDER"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Switch
            android:id="@+id/order_switch_id"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight=".90" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".10" />

        <ImageButton
            android:id="@+id/order_history_btn_id"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight=".65"
            android:background="@null"
            android:src="@drawable/ic_history_gray" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".20" />

        <ImageButton
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight=".64"
            android:background="@null"
            android:id="@+id/order_search_btn_id"
            android:padding="5dp"
            android:src="@drawable/ic_search_gray"
            android:textAllCaps="true"
            android:textColor="#fff" />


    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp">

        <EditText
            android:id="@+id/order_medicinename_edt_id"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@drawable/input_layout"
            android:hint="Medicine Name"
            android:padding="13dp"
            android:textColor="#ffff"
            android:textColorHint="#8A8B8F" />

        <ImageButton
            android:id="@+id/name_check_btn_id"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_marginEnd="17dp"
            android:src="@drawable/ic_search"
            android:background="@null" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@drawable/input_layout"
            android:hint="Quantity"
            android:padding="13dp"
            android:textColor="#ffff"
            android:id="@+id/order_quantity_edt_id"
            android:textColorHint="#8A8B8F" />

        <Spinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_marginEnd="17dp"
            android:id="@+id/order_spiner_btn_id"
            android:background="@drawable/ic_spanir"
             />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="13dp"
            android:textSize="18dp"
            android:text="Doctore Prescription"
            android:textColor="#ffff" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:drawableLeft="@drawable/ic_attacher_white"
            android:textColor="#fff"
            android:id="@+id/order_attachimage_btn_id"
            android:background="@drawable/btn_background"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:text="  IMAGE" />
    </RelativeLayout>
      </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight=".50"
            >
            <android.support.v7.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="#fff"
                android:id="@+id/order_recycler_id"
                />

        </LinearLayout>

          <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:orientation="vertical"
                    android:layout_weight="1.70"
                   android:weightSum="1.50"
                    >

               <LinearLayout
                   android:layout_width="match_parent"
                   android:layout_height="0dp"
                   android:orientation="vertical"
                   android:layout_weight="1.50"
                   android:gravity="bottom"
                   >
                 <Button
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/btn_background"
                  android:text="ORDER"
                  android:id="@+id/order_order_btn_id"
                  android:textColor="#fff"
                  android:textStyle="bold"
                  />
                <TextView

                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Or by doctor Prescription"
                    android:textAlignment="center"
                    android:textSize="20dp"
                    android:padding="2dp"
                    android:textColor="#8F9196"
                    />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/btn_background"
                    android:text="IMAGE"
                    android:drawableLeft="@drawable/ic_attacher_white"
                    android:id="@+id/order_image_btn_id"
                    android:textColor="#fff"
                    android:textStyle="bold"
                    android:gravity="center|left"
                    android:paddingLeft="50dip"
                    />
               </LinearLayout>
          </LinearLayout>

    </LinearLayout>

</ScrollView>

</LinearLayout>
Saveen
  • 4,120
  • 14
  • 38
  • 41
Tajmir khan
  • 17
  • 1
  • 7

2 Answers2

0

This will work for you

 <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none">

    <LinearLayout
    android:id="@+id/rightLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/lay1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#ff0000" >

    <!--Your listview goes here as pr your image-->

        <TextView
            android:id="@+id/textView01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TextView" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/lay2"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="#00ff00" >

        <TextView
            android:id="@+id/TextView02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TextView" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/lay3"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1" 
        android:background="#0000ff">

        <TextView
            android:id="@+id/TextView03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TextView" />
    </LinearLayout>
  </ScrollView>
Sandeep Parish
  • 1,888
  • 2
  • 9
  • 20
0

give the fixed size your ListView

Change wrap_content to 180dp something like that , As Per Your Requirement

then the show your 3rd view ..not anymore hide ...

and you can your layout making all mobile compatible then you can use your all linearLayout size not given , given weight= 1 then all are same views all mobiles they cant change, they equally parts on screen

MohammedAli
  • 2,361
  • 2
  • 19
  • 36