我在使用 ViewPaper
时遇到了问题。当我将 ViewPaper 的高度设置为 wrap_content
时,它不显示任何内容;但是如果我为 ViewPager
设置高度 (例如:android:layout_height= "350dp"
),则可以正常显示。请帮忙解决!谢谢!
这是我的 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#FF0000"
android:gravity="center"
android:text="Quick Links"
android:textColor="@color/white"
android:textSize="20sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/circlePage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/pager"
android:layout_marginBottom="10dp" >
</com.viewpagerindicator.CirclePageIndicator>
</RelativeLayout>
<com.custom.ExpandableHeightListView
android:id="@+id/lvAdmissions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:divider="@drawable/bg_listview_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/selector_animation" >
</com.custom.ExpandableHeightListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
已解决: 我跟随这个链接并且它帮助我解决了这个问题。 https://dev59.com/K2oy5IYBdhLWcg3wq_7O#24666987