繁体   English   中英

使整个活动在android中可滚动

[英]making an entire activity scrollable in android

我正在使用xml文件进行活动。 xml具有相对布局。

在布局内..我有小部件作为

Textview..Gridview..Edittext..Button ...的顺序与上述相同。

我想使整个布局为可滚动的。 为此,我尝试在根级布局中添加Scrollable。

但是,当我启动活动时,只有Gridview部分变为可滚动的。

我希望整个活动是可滚动的..而不是gridview部分。

活动中有Gridview时,Scrollable有什么问题吗?

尝试将滚动视图与所需的相对布局或线性布局一起使用,然后将对象放入其中。

<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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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