首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓: ScollView和ViewPager的问题

安卓: ScollView和ViewPager的问题
EN

Stack Overflow用户
提问于 2016-03-14 12:14:14
回答 1查看 44关注 0票数 0

我正在创建如下代码所示的UI

使用图像查看寻呼机,然后查看其他UI控件。它在2-3控件中工作得很好,但是如果UI与10个UI控件脱离页面,那么滚动视图就不会被唤醒。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fadeScrollbars="true"
        android:fillViewport="true" >

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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" >

                <android.support.v4.view.ViewPager
                    android:id="@+id/scheduleViewPager"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="2"
                android:orientation="vertical" >

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/create_account_create_password" />

                // Other UI controls

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

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-14 12:42:37

请试试下面的代码..。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fadeScrollbars="true"
    android:fillViewport="true">

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="160dp">

            <android.support.v4.view.ViewPager
                android:id="@+id/scheduleViewPager"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="2"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/create_account_create_password" />

            // Other UI controls
        </LinearLayout>
    </LinearLayout>
</ScrollView>   
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35987275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档