soarcn / BottomSheet

One way to present a set of actions to a user is with bottom sheets, a sheet of paper that slides up from the bottom edge of the screen. Bottom sheets offer flexibility in the display of clear and simple actions that do not need explanation.
http://soarcn.github.io/BottomSheet
2.22k stars 409 forks source link

How to disable items appearing animation? #78

Closed androideveloper closed 9 years ago

androideveloper commented 9 years ago

I want bottom sheet to be like in Dropbox

soarcn commented 9 years ago

61

androideveloper commented 9 years ago

Can you please provide some code for style that disables animation? Because I haven't found solution in #61 and have tried many ways, but animation still shows.

soarcn commented 9 years ago

what you need to do is customize your bottomsheet style and set @null

Please check sample "Style" for how to style bottomsheet.

androideveloper commented 9 years ago

What you mean by saying that? What do I need to set @null??

<style name="BottomSheet.StyleDialog" parent="BottomSheet.Dialog">
    <item name="android:backgroundDimAmount">0.5</item>
    <item name="android:windowAnimationStyle">@null</item>
    <item name="android:textColorPrimary">#DDffffff</item>
    <item name="android:textColorSecondary">#8Affffff</item>
    <item name="android:textColorHint">#42ffffff</item>
    <item name="bs_dialogBackground">@color/abc_search_url_text_normal</item>
    <item name="bs_dividerColor">@color/abc_search_url_text_pressed</item>
    <item name="bs_numColumns">4</item>
    <item name="bs_listStyle">@style/BottomSheet.StyleList</item>
</style>

or

soarcn commented 9 years ago

In your case,

<style name="BottomSheet.StyleDialog" parent="BottomSheet.Dialog">
    <item name="android:backgroundDimAmount">0.5</item>
    <item name="android:windowAnimationStyle">@null</item>
    <item name="android:textColorPrimary">#DDffffff</item>
    <item name="android:textColorSecondary">#8Affffff</item>
    <item name="android:textColorHint">#42ffffff</item>
    <item name="bs_dialogBackground">@color/abc_search_url_text_normal</item>
    <item name="bs_dividerColor">@color/abc_search_url_text_pressed</item>
    <item name="bs_numColumns">4</item>
    <item name="bs_listStyle">@style/BottomSheet.StyleList</item>      <--------
</style>

You need to have your own listStyle, like

 <style name="BottomSheet.StyleList" parent="BottomSheet.List.Dark" >
        <item name="android:listSelector">@drawable/list_selector</item>
        <item name="android:layoutAnimation">@null</item>    <---- this is the key
    </style>

and use BottomSheet.StyleDialog as your bottomsheet style

androideveloper commented 9 years ago

Thanks a lot! Finally! List style is the key!

To everyone who wants to disable only list animation and bottom sheet will be like in dropbox or somewhere else:

<style name="BottomSheet.StyleDialog" parent="BottomSheet.Dialog">
    <item name="android:backgroundDimAmount">0.5</item>
    <item name="android:windowAnimationStyle">@style/BottomSheet.Animation</item>
    <item name="bs_listStyle">@style/BottomSheet.StyleList</item>
</style>

<style name="BottomSheet.StyleList" parent="BottomSheet.List">
    <item name="android:layoutAnimation">@null</item>
</style>

And then use this style for creating bottom sheet: new BottomSheet.Builder(this, R.style.BottomSheet_StyleDialog)