简体   繁体   中英

making an entire activity scrollable in android

I am having an activity with an xml file. The xml is having Relative Layout.

Inside the layout..I have widgets as

Textview..Gridview..Edittext..Button...in the same order as mentioned.

I want to make the entire layout as Scrollable. To do this, i tried to add Scrollable at the root level layout.

But when i launch the activity, only Gridview section becomes scrollable.

I want the entire activity to be scrollable..not the gridview section.

is there any issue with Scrollable when there is a Gridview inside the activity?

Try out to use a scrollview with a relativelayout or linerlayout, what you want, and then put yout objects in this.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/rloverworld"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    tools:context="com.gore.fruitsplashparty.Overworld" >
 <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="0dp"
        android:scrollbars="none" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:padding="0dp" >

            <Button
                android:id="@+id/btn_101"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:adjustViewBounds="true"
                android:background="@drawable/btnlvl"
                android:padding="0dp"
                 />
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM