ViewPager滚动型中没有滚动条(ViewPager in ScrollView no Scrollbar)

161 IT屋

在我的XML风格我用android.support.v4.view.ViewPager滚动型内。问题是,我不得到滚动条。此外,当我从一个页面滑动到另一个ViewPager本身的行为很奇怪。

设置滚动型到一个固定的高度例如1200dip有助于滚动,但犯规显示ViewPager。
这里是我的xml:

 <?XML版本="1.0"编码="UTF-8"&GT?;
<滚动型的xmlns:机器人="htt​​p://schemas.android.com/apk/res/android"
    机器人:ID ="@ + ID /滚动视图"
    机器人:layout_width ="FILL_PARENT"
    机器人:layout_height ="FILL_PARENT"
    机器人:fadeScrollbars ="真"
    机器人:fillViewport ="真"
    机器人:滚动条="垂直">
    < RelativeLayout的
        的xmlns:机器人="htt​​p://schemas.android.com/apk/res/android"
        机器人:layout_width ="FILL_PARENT"
        机器人:layout_height ="match_parent"
        机器人:方向="垂直">        <的TextView
            机器人:ID ="@ + ID / textView1"
            机器人:layout_width ="match_parent"
            机器人:layout_height ="WRAP_CONTENT"
            机器人:文字="@字符串/菜单"
            />        < android.support.v4.view.ViewPager
            机器人:ID ="@ + ID /寻呼机"
            机器人:layout_width ="match_parent"
            机器人:layout_height ="match_parent">
        < /android.support.v4.view.ViewPager>
    < / RelativeLayout的>< /滚动型>

在此先感谢


解决方案

找到了解决办法 -

<一个href=\"http://stackoverflow.com/questions/2646028/android-horizontalscrollview-within-scrollview-touch-handling\">Android - 滚动型触摸内Horizo​​ntalScrollView处理

in my xml style I use a android.support.v4.view.ViewPager within a ScrollView. The problem is that I dont get a scrollbar. The ViewPager itself behaves also strange when I slide from one page to another.

Setting the ScrollView to a fixed height e.g. 1200dip helps to scroll but doesnt show the ViewPager. Here is my xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fadeScrollbars="true"
    android:fillViewport="true"
    android:scrollbars="vertical" >


    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >



        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/menu"
            />

        <android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </android.support.v4.view.ViewPager>
    </RelativeLayout>

</ScrollView>

thanks in advance

解决方案

found the solution –

Android - HorizontalScrollView within ScrollView Touch Handling

本文地址:IT屋 » ViewPager滚动型中没有滚动条

相关文章: