2014-11-03 79 views
0

嗨,我試圖利用圖書館從下面的鏈接我的應用程序來實現parallaxscrollview: -parallaxscroll觀點是不工作

https://github.com/nirhart/ParallaxScroll

而下面是我的XML代碼: -

<com.nirhart.parallaxscroll.views.ParallaxScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:inner_parallax_factor="1.9" 
    app:parallax_factor="1.9" 
    app:parallax_views_num="3" 
    android:background="@drawable/bg_profile_summary" > 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <LinearLayout 
      android:id="@+id/LIN_First" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:baselineAligned="false" 
      android:weightSum="2" > 

      <RelativeLayout 
       android:id="@+id/REL_People" 
       android:layout_width="0dp" 
       android:layout_height="60dp" 
       android:layout_weight="1" 
       android:background="@drawable/bg_profile_list_item" 
       android:padding="10dp" > 

       <TextView 
        android:id="@+id/TXT_Title" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="5dp" 
        android:textStyle="bold" 
        android:text="@string/str_txt_people" 
        android:textColor="#FFFFFF" /> 

       <ImageView 
        android:id="@+id/IMG_Right_Arrow" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true" 
        android:layout_centerVertical="true" 
        android:layout_gravity="right" 
        android:contentDescription="@string/app_name" 
        android:src="@drawable/ic_nav_right_white" /> 
      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/REL_Popular" 
       android:layout_width="0dp" 
       android:layout_height="60dp" 
       android:layout_weight="1" 
       android:background="@drawable/bg_profile_list_item" 
       android:padding="10dp" > 

       <TextView 
        android:id="@+id/TXT_TitlePopular" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="5dp" 
        android:textStyle="bold" 
        android:text="@string/str_txt_popular" 
        android:textColor="#FFFFFF" /> 

       <ImageView 
        android:id="@+id/IMG_Right_Arrow1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true" 
        android:layout_centerVertical="true" 
        android:layout_gravity="right" 
        android:contentDescription="@string/app_name" 
        android:src="@drawable/ic_nav_right_white" /> 
      </RelativeLayout> 

      </LinearLayout> 

    <RelativeLayout 
       android:id="@+id/REL_Official_Act" 
       android:layout_width="match_parent" 
       android:layout_height="60dp" 
       android:layout_below="@+id/LIN_First" 
       android:background="@drawable/bg_profile_list_item" 
       android:padding="10dp" > 

       <TextView 
        android:id="@+id/TXT_OfficialAccounts" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_gravity="center_vertical" 
        android:layout_marginLeft="5dp" 
        android:textStyle="bold" 
        android:text="@string/str_official_accounts" 
        android:textColor="#FFFFFF" /> 

       <ImageView 
        android:id="@+id/IMG_Right_Arrow3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true" 
        android:layout_centerVertical="true" 
        android:layout_gravity="right" 
        android:contentDescription="@string/app_name" 
        android:src="@drawable/ic_nav_right_white" /> 
      </RelativeLayout> 



      <RelativeLayout 
       android:id="@+id/REL_Search" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/REL_Official_Act" 
       android:layout_marginBottom="10dp" 
       android:layout_marginTop="10dp" 
       android:paddingLeft="10dp" 
       android:paddingRight="10dp" > 

       <EditText 
        android:id="@+id/EDT_Search_text" 
        android:layout_width="250dp" 
        android:layout_height="35dp" 
        android:background="@drawable/ic_search_text_background" 
        android:hint="@string/str_edt_searchanything_hint" 
        android:paddingBottom="2dp" 
        android:paddingLeft="15dp" 
        android:paddingTop="2dp" /> 

       <RelativeLayout 
        android:id="@+id/REL_SearchButton" 
        android:layout_width="wrap_content" 
        android:layout_height="35dp" 
        android:layout_alignParentRight="true" 
        android:layout_alignParentTop="true" 
        android:layout_toRightOf="@+id/EDT_Search_text" 
        android:background="@drawable/ic_search_btn_bg" 
        android:gravity="center" > 

        <Button 
         android:id="@+id/BTN_Search" 
         android:layout_width="30dp" 
         android:layout_height="30dp" 
         android:layout_centerVertical="true" 
         android:background="@drawable/ic_search" 
         android:padding="5dp" /> 
       </RelativeLayout> 
      </RelativeLayout> 



      <ListView 
       android:id="@+id/LST_AlbumList" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:layout_alignParentBottom="true" 
       android:layout_below="@+id/REL_Search" 
       android:dividerHeight="0dip" > 
      </ListView> 

</RelativeLayout> 
</com.nirhart.parallaxscroll.views.ParallaxScrollView> 

我想實現MultipleParallaxScrollView。

但是什麼都沒有發生。 有人請解釋我該怎麼辦? 在此先感謝。

+0

你是什麼意思*什麼都沒有發生。*?你得到任何錯誤或什麼? – 2014-11-03 06:20:54

+0

@SweetWisherツ:我沒有收到任何錯誤。沒有滾動也在那裏。 。 – 2014-11-03 06:23:31

+0

你能否成功運行該鏈接的演示項目? – 2014-11-03 06:26:25

回答

1

您需要ParallaxScrollView使用的LinearLayout作爲一個孩子。

你應該把一個孩子ParallaxScrollView包含的全部內容進行滾動;這是一個LinearLayout

+0

仍然無法正常工作 – kgandroid 2015-12-11 05:34:03