java - bottomsheet stops between EXPANDED and HIDDEN -
i'm trying create bottomsheet that's either expanded or out of view - don't want anywhere in middle or peeking.
here's xml:
<linearlayout android:id="@+id/bottom_sheet" android:layout_width="250dp" android:layout_height="250dp" android:layout_gravity="center_horizontal" android:background="@android:color/holo_blue_bright" android:cliptopadding="true" android:orientation="vertical" android:elevation="10dp" app:behavior_peekheight="0dp" app:behavior_hideable="true" app:behavior_skipcollapsed="true" app:layout_behavior="android.support.design.widget.bottomsheetbehavior"> <textview android:id="@+id/delete_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@color/cinza3" android:text="clear/delete q"/> </linearlayout>
in code have following methods:
private void showhidebottomsheet() { if (mbsbehavior.getstate() != bottomsheetbehavior.state_expanded) { showbottomsheet(); } else { hidebottomsheet(); } } private void showbottomsheet() { mbsbehavior.setstate(bottomsheetbehavior.state_expanded); } private void hidebottomsheet() { mbsbehavior.setstate(bottomsheetbehavior.state_hidden); }
and in layout there's button calls showhidebottomsheet() when clicked.
when click button, works fine , bottomsheet shown/hidden. if it's expanded , click on textview elsewhere in code (outside bottomsheet), example, bottomsheet moves down little, not - it's top half visible, if log it's state, it's state_expanded.
- what's difference between state_hidden , state_collapsed? i've searched everywhere visual explanation couldn't find it. 'intermediate' state collapsed state? if set peekheight="0" in xml , skipcollapsed="true"?
- what peekheight , skipcollapsed in xml do?
- how can make visible or hidden @ times , avoid 'intermediate' state?
edit: there's textview inside bottomsheet, , and onclicklistener on it. when click it, bottomsheet goes 'intermediate' state too, though onclicklistener not call setstate or related bottomsheet.
updated support:design library 25.3.1 , started working expected.
Comments
Post a Comment