1

我只是尝试在哪个选项卡+查看寻呼机中滚动我的活动,但我没有成功。下面我展示了当我使用滚动时发生的事情。

显示查看寻呼机图像和 xml 代码

在此处输入图像描述

现在不垂直滚动

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="250dp" >

            <ImageView
                android:id="@+id/profile_user_banner_profile_user"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/shown_image"
                android:scaleType="fitXY"
                android:src="@drawable/banner" />

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <biz.xicom.defindme.profileuser.TabPageIndicator
                android:id="@+id/indicator"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:background="@drawable/tabs_bg"
                android:fillViewport="true" />

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#f1eee7"
                android:scrollbars="vertical" />

        </LinearLayout>

未显示 viewpager bcz 我在滚动视图上添加视图寻呼机但我现在不知道为什么要这样做

在此处输入图像描述

在滚动视图上添加视图寻呼机时,现在不显示视图寻呼机上的任何内容

 <ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="250dp" >

            <ImageView
                android:id="@+id/profile_user_banner_profile_user"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/shown_image"
                android:scaleType="fitXY"
                android:src="@drawable/banner" />

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <biz.xicom.defindme.profileuser.TabPageIndicator
                android:id="@+id/indicator"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:background="@drawable/tabs_bg"
                android:fillViewport="true" />

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#f1eee7"
                android:scrollbars="vertical" />

        </LinearLayout>
    </LinearLayout>
</ScrollView>

滚动但 viewpager 高度固定现在你看到发生了什么

显示视图寻呼机

在此处输入图像描述

现在你看到下面带有滚动的图像并且你看到我指向的滚动

在此处输入图像描述

  <ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="250dp" >

            <ImageView
                android:id="@+id/profile_user_banner_profile_user"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/shown_image"
                android:scaleType="fitXY"
                android:src="@drawable/banner" />

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <biz.xicom.defindme.profileuser.TabPageIndicator
                android:id="@+id/indicator"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:background="@drawable/tabs_bg"
                android:fillViewport="true" />

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_width="match_parent"
                android:layout_height="100000dp"
                android:background="#f1eee7"
                android:scrollbars="vertical" />
        </LinearLayout>
    </LinearLayout>
</ScrollView>

我想做上面的事情,但没有固定(android.support.v4.view.ViewPager android:layout_height="100000dp")的。那么我怎样才能完成这项任务。

4

1 回答 1

0

您在该布局中添加 ScrollView,您可以在其中添加/扩展布局的内容。如果您使用 Fragment 而不是将 ScrollView 保留在 FragmentLayout 而不是 ViewPager 布局中。

于 2013-06-11T10:28:16.953 回答