【发布时间】:2016-06-02 22:22:48
【问题描述】:
我在我的一个Media Player 应用程序中使用SlidingUpPanel library。
在滑动面板中,我有媒体控件,我想在顶部显示轨道的艺术作品。我遇到的问题是我希望媒体控件始终位于屏幕底部(即使用户正在拖动面板,这意味着我必须使用 onPanelSlide () 方法)。也许就像视差效果(不确定这是否是正确的名称)。这就是我现在所拥有的:
如您所见,当我拖动面板时,控件粘在顶部。我希望它贴在屏幕底部并在其上方显示艺术品。
我在想CoordinatorLayout,但我不知道它是如何工作的!
我的代码:
activity.xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="92dp"
sothree:umanoShadowHeight="4dp">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/details_slide_bar" />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
details_slide_bar.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:orientation="vertical">
<ImageView
android:id="@+id/ivArtworkBar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="92dp"
android:orientation="horizontal"
android:id="@+id/lDetailsBar">
/!-- Content of the detalBar !-->
</RelativeLayout>
</LinearLayout>
目前,我只是检查面板的状态并相应地调整艺术品的visibility。
一定有别的办法!
【问题讨论】:
标签: java android android-layout