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