2

I put a Scrollview inside of a tab on a tabLayout. There is a textview inside the scrollview, but when I try to scroll down, the page cuts short and I can't see all of the scrollview. How do I fix this?

This is my XML for the scrollview

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end">

            <TextView
                android:padding="@dimen/welcome_text_padding"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textSize="@dimen/welcome_text_size"
                android:id="@+id/intro_text"/>

        </ScrollView>
</LinearLayout>

I know that LinearLayout here is redundant, but that isn't the problem is it?

This is the fragment class

package com.example.lucas.guide;

import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class WelcomeMOBA extends Fragment{

    public WelcomeMOBA() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View myInflatedView =         inflater.inflate(R.layout.fragment_welcome_moba, container,false);

        final TextView introText = (TextView) myInflatedView.findViewById(R.id.intro_text);

        introText.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "HelveticaNeueLight.otf"));
        introText.setText("this is text and it exceeds the screenspace");

        return myInflatedView;
    }
}

Also, here is the XML of the class which contains the above fragment.

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMode="fixed"
        app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"  />

And finally, here's an image of my problem:The greyed out area scrolls fine, but when I get to the blue part, the scrolling stops and wont let me go further. There is text beyond the screen. enter image description here

Luke Wang
  • 143
  • 2
  • 9

1 Answers1

0

try this once, it may solve the problem

<ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:fillViewport="true"
        android:scrollbars="vertical">