Slide View from Top Over the another layout androi

2019-08-08 18:34发布

问题:

I want to slide-in/Slide-out my View from top over the another view. When the top view slide in, the first visible view become fade and if user click outside the top view, it will slide-out again using bottom-to-top animation and first view become completely visible again. For example, you can check the line chat layout, in which user can check the different option by clicking on the top right button in action bar and button become visible over the chat screen.

回答1:

This is what you need:

https://github.com/wunderlist/android-sliding-layer-lib

<com.wunderlist.slidinglayer.SlidingLayer
    xmlns:slidingLayer="http://schemas.android.com/apk/res-auto"
    android:id="@+id/slidingLayer1"
    android:layout_width="@dimen/layer_width"
    android:layout_height="@dimen/layer_height"
    slidingLayer:shadowDrawable="@drawable/sidebar_shadow"
    slidingLayer:shadowSize="@dimen/shadow_size"
    slidingLayer:offsetDistance="@dimen/offset_distance"
    slidingLayer:previewOffsetDistance="@dimen/preview_offset_distance"
    slidingLayer:stickTo="top|bottom|right|left"
    slidingLayer:changeStateOnTap="true">

</com.wunderlist.slidinglayer.SlidingLayer>

You can change the sliding pattern/direction here.

Install this app before you proceed with its integration: https://play.google.com/store/apps/details?id=com.slidinglayersample&hl=en