MartinRajniak/BottomBarDrawer

Question: How do I limit the height of the bottom drawer (not the handle but the content)?

Closed this issue · 3 comments

Hi,

I'd like to limit the height of the bottom drawer so that when I drag it upwards it only covers the bottom 1/2 of the screen. How do I prevent it from going to the full height of the screen?

Also, I modified the example to remove the code that hides the actionbar when the offset is > 0.8. Is there a way to prevent the bottom bar handle from disappearing under the action bar, and have it rest underneath?

Thanks,

Andy.

I start with your second question:
In styles.xml remove this line:

<item name="android:windowActionBarOverlay">true</item>

It causes that ActionBar is overlayed over your content. This is used for this hiding of action bar feature, cause otherwise the content would jump at one point and the animation would not be as smooth.

The answer for your first question is that you can't. At least not now, it is not implemented, but I will look at it and post an update.

As I imagine it, there are two things I need to do on the code:

  1. Value of top resting place for when drawer is opened should be counted from the height of the drawer
  2. As it is now, when drawer is opened content that is behind the drawer is not drawn (optimization), I have to change this to not draw the content behind drawer only when drawer is opened and top resting value of the drawer is zero

It is implemented.
I haven't created a demo for that, but what you need to do is to set the drawer parent view to 'wrap_content' in layout_height and the height you want to have for your drawer content is then defined inside of the view.

If I would show it on my example it would look like this:

<sk.rajniak.bottombardrawer.BottomBarDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:bbdl="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    bbdl:bottomBarHeight="75dp" >
    <RelativeLayout
        android:id="@android:id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#00FF00"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >
    </RelativeLayout>
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <View
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:background="#FF0000" />
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:background="#00FFFF" />
    </FrameLayout>
</sk.rajniak.bottombardrawer.BottomBarDrawerLayout>