[英]making an entire activity scrollable in android
I am having an activity with an xml file. 我正在使用xml文件进行活动。 The xml is having Relative Layout. xml具有相对布局。
Inside the layout..I have widgets as 在布局内..我有小部件作为
Textview..Gridview..Edittext..Button...in the same order as mentioned. Textview..Gridview..Edittext..Button ...的顺序与上述相同。
I want to make the entire layout as Scrollable. 我想使整个布局为可滚动的。 To do this, i tried to add Scrollable at the root level layout. 为此,我尝试在根级布局中添加Scrollable。
But when i launch the activity, only Gridview section becomes scrollable. 但是,当我启动活动时,只有Gridview部分变为可滚动的。
I want the entire activity to be scrollable..not the gridview section. 我希望整个活动是可滚动的..而不是gridview部分。
is there any issue with Scrollable when there is a Gridview inside the activity? 活动中有Gridview时,Scrollable有什么问题吗?
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.