2017-04-18 94 views
0

我有一个图像滑块顶部和下面的列表视图。列表视图滚动,但滑块仍然是静态的,我想要的是,如果我滚动,滑块也应该上去。请提供解决方案this is my layoutAndroid滚动整个屏幕不仅列表视图

这是我的XML代码

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:custom="http://schemas.android.com/apk/res-auto" 
android:id="@+id/activity_main" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.dzone.image_ki_duniya.MainActivity"> 

<com.daimajia.slider.library.SliderLayout 
    android:id="@+id/cover" 
    android:layout_width="match_parent" 
    custom:pager_animation="Accordion" 
    custom:auto_cycle="true" 
    custom:indicator_visibility="visible" 
    custom:pager_animation_span="1100" 
    android:layout_height="200dp"/> 

<com.daimajia.slider.library.Indicators.PagerIndicator 
    android:id="@+id/custom_indicator" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    custom:selected_color="#0095BF" 
    custom:unselected_color="#55333333" 
    custom:selected_drawable="@drawable/left" 
    custom:shape="oval" 
    custom:selected_padding_left="6dp" 
    custom:selected_padding_right="6dp" 
    custom:unselected_padding_left="2dp" 
    custom:unselected_padding_right="2dp" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    custom:selected_width="6dp" 
    custom:selected_height="6dp" 
    custom:unselected_width="6dp" 
    custom:unselected_height="6dp" 
    android:layout_marginBottom="20dp" 
    /> 
<!--<com.daimajia.slider.library.Indicators.PagerIndicator--> 
    <!--android:id="@+id/custom_indicator2"--> 
    <!--style="@style/AndroidImageSlider_Corner_Oval_Orange"--> 
    <!--android:layout_centerHorizontal="true"--> 
    <!--android:layout_alignParentBottom="true"--> 
    <!--android:layout_marginBottom="20dp"--> 
    <!--/>--> 


<ListView 
    android:id="@+id/listview" 
    android:layout_marginTop="5dp" 
    android:layout_below="@+id/cover" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"></ListView> 

+1

解决方法之一就是将想要滚动的部分作为标题视图放入列表视图中。请参阅https://developer.android.com/reference/android/widget/ListView.html#addHeaderView(android.view.View) – njzk2

+0

@ njzk2的解决方案是实现您想要的目标的唯一方法。 –

回答

0

在滚动视图将所有的东西。确保scrollview只能托管一个父视图。