2017-07-07 91 views
1

我想模仿谷歌街景佈局。 我有一個viewpager與一張地圖。我想在每個頁面的底部顯示一個回收站,然後拖動+從底部滾動。 這裏是理想的結果(我不需要隱藏操作欄):Android從地圖下方拖放回收站視圖片段

enter image description here

你就會知道,以便有從底部效果相同的阻力/滾動使用哪些佈局?

我總算有myviewpager單個地圖:

enter image description here

,但是當我在viewpager片段添加recyclerView,它顯然隱藏地圖:

enter image description here

權現在我的標籤片段僅由回收站視圖組成

<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/recyclerview" 
android:layout_width="match_parent" 
android:visibility="invisible" 
android:layout_height="wrap_content" 
android:layout_marginEnd="8dp" 
android:layout_marginStart="8dp" 
tools:listitem="@layout/fragment_topic_list" /> 

我試圖使用底部工作表,但它捕捉地圖事件,我無法控制滾動(慣性)。

+0

您可以使用此庫從底部通過地圖片段拖放回收站視圖https://github.com/umano/AndroidSlidingUpPanel –

+2

使用https://developer.android.com/reference/android/support/design/widget/ BottomSheetDialogFragment.html –

+0

底部表單片段的問題是我無法控制拖動。它在關閉或打開狀態 –

回答

1

底頁是設計支持庫中鮮爲人知的一部分。設計支持庫是一個Android庫,旨在幫助Android開發人員實施Google材料設計指南。

底部牀單可以上下拖動。你需要更多地探索它。我可以指點你一些有用的資源。你應該關注他們。我真的認爲他們可以幫助你。

克隆這個格子應用程序的repo並研究代碼。它是在它使用底層用拖放

也遵循這個tutorial它會幫助你瞭解底層

的,我希望這個答案會幫助你的行爲。

+0

謝謝您的資源。這是我需要的。 –

+0

如果這幫助你,然後接受它作爲答案。 –