2015-09-20 111 views
0

我有一個活動,當用戶從上到下滑動時,活動頂部的視圖會隨着用戶滑動多遠而下降。關於這個問題有類似的話題,但他們不完全是我想要的。我怎樣才能做到這一點。Android下拉顯示活動頂部的視圖

在開始時,視圖在Activity之外。當用戶開始拉動。它將在活動的頂部下降,整個視圖將作爲幻燈片的一部分下降。

回答

2

這個答案遲到了,但它可能對另一個有幫助。您可以使用this library
結果是這樣的:

enter image description here

只要改變你的佈局是這樣的:

<github.chenupt.dragtoplayout.DragTopLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<!--top view--> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:orientation="vertical"> 
    ... 
</LinearLayout> 

<!--content view--> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    ... 
</LinearLayout> 

相關問題