Android 使用滚动条滑动标签

Android swipe tab with scroller

我正在使用 Material 滑动标签来显示滑动 3 种不同的片段布局。 这是滑动选项卡的 xml 布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<include
    android:id="@+id/tool_bar"
    layout="@layout/tool_bar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    />

<com.android4devs.slidingtab.SlidingTabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="2dp"/>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"

    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:layout_weight="1"
    ></android.support.v4.view.ViewPager>
    </LinearLayout>

现在滑动的 xml 布局片段有一个固定在布局底部的按钮,所以当我滑动到这个片段时,片段的布局被剪切见图像:

有什么方法可以将布局片段固定到 ViewPager 中,或者有什么方法可以用滚动视图滚动它吗?

谢谢

在你的第二个Fragment中,你可以使用

scrollView.post(new Runnable() {            
    @Override
    public void run() {
           scrollView.fullScroll(View.FOCUS_DOWN);              
    }
});

ScrollView 滚动到底部,这样您的 Button 就会完全可见。