1

Here I have two files. I want to enable scrolling vertically in the viewpager. The content of the page exceeds the size of the page. Even though the content exceeds page size... I dont get a scroll. Plz help.

<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:fillViewport="true" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout android:id="@+id/secAct1" android:layout_height="25dip" android:layout_width="match_parent" android:background="#000000" android:layout_alignParentBottom="true" > <TextView android:id="@+id/cn1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:paddingLeft="10dip" android:textColor="@color/white" android:textSize="15sp" android:text="cn" /> <TextView android:id="@+id/si1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingRight="10dip" android:layout_alignParentRight="true" android:textColor="@color/white" android:textSize="15sp" android:text="si" /> </RelativeLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/secAct1" android:orientation="vertical" android:gravity="center" android:padding="30dip"> <Button android:id="@+id/submitAll" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Submit Responses" /> <TextView android:id="@+id/lp" android:layout_width="wrap_content" android:layout_height="match_parent" android:textColor="@color/white" android:text="Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.\nThank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.\nThank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.\nThank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.\nThank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet.Thank you for your valuable responses!\n On submitting, you will not be able to changes your responses.\nYou responses will be uploaded when your device is connected to the internet." > </TextView> </LinearLayout> </RelativeLayout></ScrollView> 

next file

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragQue" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/radialback" > <android.support.v4.view.PagerTabStrip android:id="@+id/pager_title_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:paddingTop="@dimen/fQ_P" android:paddingBottom="@dimen/fQ_P" android:background="@color/yellow" android:textColor="@color/textGray" /> </android.support.v4.view.ViewPager > </LinearLayout> 
1

1 Answer 1

1

For the first you have it so that the textview is above the cn & si buttons, even though the buttons are at the bottom of the screen, it isn't working the way you want it to.

android:layout_above="@+id/secAct1" //should be android:layout_below="@+id/secAct1" 

That will give you submit button and text view on top with cn & si buttons underneath and be scroll-able. If you want the cn & si buttons on top, in the second relative layout, change

android:layout_alignParentBottom="true" //to android:layout_alignParentTop="true" 

As for the second file, I don't know if the viewpager has a default scroll or not, so you might just have to wrap it in a scrollview.

Sign up to request clarification or add additional context in comments.

1 Comment

Honestly, I have no idea why your original code wasn't doing what you wanted it to. The only thing I can think of is that having the relative layout aligned to the bottom of the parent relative layout was causing the android:layout_above="@+id/secAct1 to be set as above the parent layout. But that is just a guess.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.