-3

I want activity in which part one is scrollable and part two remains still.

enter image description here

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

2 Answers2

0

You can use a vertical Linear layout as the parent with two children.

Child 1 - Scrollview with weight 1

Child 2 - A view with height as wrap_content

Rishabh Jain
  • 297
  • 2
  • 13
0

use something along the lines of this code

<?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:orientation="vertical">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0"
        android:layout_weight="3"
        android:background="#abc">
        <!--some content for scrolling here-->
    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0"
        android:layout_weight="1"
        android:background="#cba">
        <!--put other component here-->
    </LinearLayout>
</LinearLayout>

here the ScrollView has a layout weight of 3 vs 1 for the LinearLayout so it will take 75% of height and 25% will be given to LinearLayout

Doc
  • 10,831
  • 3
  • 39
  • 63