2017-04-18 8 views
0

私は一番上に画像スライダーを、下にリストビューを持っています。リストビューはスクロールしますが、スライダは静的なままです。私が望むものは、スクロールするとスライダも上がるはずです。親切ソリューションにthis is my layoutアンドロイドスクロール全画面表示だけでなく、リストビュー

を提供し、これはscrollviewにすべてを入れて、私の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

解決策の1つは、スクロールしたい部分をヘッダービューとしてリストビューに配置することです。 https://developer.android.com/reference/android/widget/ListView.html#addHeaderView(android.view.View) – njzk2

+0

@ njzk2のソリューションは、あなたがしたいことを達成する唯一の方法です。 –

答えて

0

です。 scrollviewは1つの親ビューのみをホストできることを確認してください。

関連する問題