Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sliding up panel crashes with Navigation Drawer #113

Closed
AkshayChordiya opened this issue Feb 16, 2014 · 16 comments
Closed

Sliding up panel crashes with Navigation Drawer #113

AkshayChordiya opened this issue Feb 16, 2014 · 16 comments
Labels

Comments

@AkshayChordiya
Copy link

Hi,

First of all, Thanks for providing this awesome library. I wanna use this library with the new Navigation Drawer.
I tried implementing but the app crashes.

I hope someone can help me solve this problem.

@powelldev
Copy link

Same. Having DrawerLayout as the root of the layout with a slidinguppanellayout child results in this error:
ava.lang.IllegalStateException: Child com.sothree.slidinguppanel.SlidingUpPanelLayout{6556d8e8 V.ED.... ......I. 0,0-0,0 #7f0b0000 app:id/sliding_layout} at index 0 does not have a valid layout_gravity - must be Gravity.LEFT, Gravity.RIGHT or Gravity.NO_GRAVITY

And modifying the gravity of the SlidingUpPanelLayout results in this error:

llegalArgumentException: layout_gravity must be set to either top or bottom
E/AndroidRuntime(12867): at com.sothree.slidinguppanel.SlidingUpPanelLayout.(SlidingUpPanelLayout.java:239)
E/AndroidRuntime(12867): at com.sothree.slidinguppanel.SlidingUpPanelLayout.(SlidingUpPanelLayout.java:228)
E/AndroidRuntime(12867): ... 22 more

@tokudu
Copy link
Contributor

tokudu commented Feb 21, 2014

You must specify the layout_gravity property in SlidingUpPanelLayout.

@tokudu tokudu closed this as completed Feb 21, 2014
@powelldev
Copy link

This occurs with the layout_gravity property set:

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:sothree="http://schemas.android.com/apk/res/..."
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom"
        sothree:collapsedHeight="@dimen/header_height"
        sothree:shadowHeight="4dp" >

        <FrameLayout
            android:id="@+id/fragment_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <FrameLayout
            android:id="@+id/lower_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

    <ListView android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:background="#111"/>
    </android.support.v4.widget.DrawerLayout>```

@tokudu tokudu reopened this Feb 21, 2014
@tokudu tokudu added the bug label Feb 21, 2014
@tokudu
Copy link
Contributor

tokudu commented Feb 21, 2014

That's probably a bug. I will have a look.

@BradleyRL
Copy link

Im using it wiithout problems with the Navigation Drawer

 <android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_height="match_parent">

<!-- As the main content view, the view below consumes the entire
     space available using match_parent in both dimensions. -->
<com.sothree.slidinguppanel.SlidingUpPanelLayout
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<FrameLayout
    android:id="@+id/content_frame"        
    android:layout_width="match_parent"        
    android:layout_height="match_parent" />

 <LinearLayout
        android:id="@+id/panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"                                                            
        android:orientation="vertical">

     <TextView
         android:id="@+id/LogTitle"
         android:layout_width="match_parent"
         android:layout_height="20dp"
         android:background="#ff33b6ea"
         android:gravity="center"
         android:text="@string/log"
         android:textColor="#FFF"
         android:textSize="12sp" />

    <ScrollView
    android:id="@+id/LogScroll"
    android:layout_width="fill_parent"  
    android:layout_height="75dp"     
    android:scrollbars="vertical"      
    android:background="@layout/lines"
    android:fillViewport="true" >

<TextView
    android:id="@+id/textViewLog"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"           
    android:ems="10"        
    android:gravity="top|left"
    android:scrollbars="vertical"        
    android:textColor="@color/holo_green_dark"        
    android:textSize="12sp" />

 </ScrollView>

 </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat
     this as a sliding drawer on the left side for left-to-right
     languages and on the right side for right-to-left languages.
     The drawer is given a fixed width in dp and extends the full height of
     the container. A solid background is used for contrast
     with the content view. -->
<ListView

    android:id="@+id/left_drawer"
    android:layout_width="220dp"
    android:layout_height="match_parent"        
    android:layout_gravity="start"        
    android:choiceMode="singleChoice"        
    android:background="?attr/card_color"/>

</android.support.v4.widget.DrawerLayout>

@powelldev
Copy link

It looks like commit 0d3be introduced a check for correct values of layout_gravity. If no correct value is found an exception is thrown. However, setting the layout_gravity as bottom will throw an exception in the onMeasure of the DrawerLayout.

My workaround is to hardcode the gravity in the constructor.

I'm not sure of best practices, but I recommend adding a .setGravity( TOP | BOTTOM) or custom xml option for SlidingUpPanelLayout. This way we avoid DrawerLayout's check of its child views and still allow for custom gravity settings.

@AkshayChordiya
Copy link
Author

@powelldev
Maybe that's the issue

@BradleyRL
What have you changed to make it work ?

Hey guys check this out
Check out this link 👍
https://www.dropbox.com/sh/rxjrw3l613la1uc/ZHSNRoZfPI

The sliding up drawer works but has some overlapping issues.
Hope someone fixes it up.

@lmbd
Copy link

lmbd commented Feb 22, 2014

I'm facing the same problem @powelldev how you fixed this issue?

@tokudu
Copy link
Contributor

tokudu commented Feb 22, 2014

I just checked in 77a8fba. The attribute was named incorrectly, it should have been gravity instead of layout_gravity. Let me know if that fixes your issues.

@tokudu tokudu closed this as completed Feb 22, 2014
@AkshayChordiya
Copy link
Author

@tokudu
It prevents the crash. Sliding panel also comes & slides. But I'm unable to touch the back view nor the sliding drawer

@sothree
Copy link
Contributor

sothree commented Feb 24, 2014

Can you post your code somewhere? We have a NagivationDrawer in Umano, and
everything is working fine. At this point, I would need to see the code to
help you.

Anton

On Sun, Feb 23, 2014 at 1:43 AM, Akshay notifications@github.com wrote:

@tokudu https://github.com/tokudu
It prevents the crash. But I'm unable to touch the view

Reply to this email directly or view it on GitHubhttps://github.com//issues/113#issuecomment-35827767
.

Anton Lopyrev
Co-Founder & CTO * SoThree, Inc.
(415) 735-0354
http://umanoapp.com

@AkshayChordiya
Copy link
Author

@sothree
I'll upload it as fast possible with few screenshots.
Can you upload the navigationDrawer+Sliding drawer xml file so that I can study it ?

@AkshayChordiya
Copy link
Author

@sothree
OFFTOPIC
Is there any way to add an bottom bar while maintaining Navigation Drawer ?
Because bottom bar uses layout_gravity="bottom" which crashes the app

@gautamverma
Copy link

I am using it DrawerLayout but the Sliding Panel is not getting dragged. Tried moving it move the fragment but it also didn't help.

Layout File

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- The main content view  -->
<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom">

    <FrameLayout
        android:id="@+id/base_content_frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:id="@+id/base_drawer"
        android:orientation="horizontal"
        android:paddingTop="8dp"
        android:background="@color/Blue_700"
        android:layout_height="68dp"
        android:layout_width="match_parent">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="0dp"
            android:layout_weight="6"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/track_title"
                android:maxLines="1"
                android:ellipsize="marquee"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/black_text_color"
                android:textSize="@dimen/text_content_size"/>

            <TextView
                android:id="@+id/track_desc"
                android:maxLines="1"
                android:ellipsize="marquee"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/black_text_color"
                android:textSize="@dimen/text_subtext_size"/>
        </LinearLayout>

        <ImageView
            android:id="@+id/playPauseButton"
            android:src="@drawable/play_light"
            android:layout_width="0dp"
            android:layout_weight="2"
            android:layout_height="48dp"/>
    </LinearLayout>

</com.sothree.slidinguppanel.SlidingUpPanelLayout>

<RelativeLayout
    android:id="@+id/base_left_drawer"
    android:layout_width="280dp"
    android:layout_height="match_parent"
    android:layout_gravity="start" />

</android.support.v4.widget.DrawerLayout>

The method onInterceptTouchEvent of SlidingUpPanelLayout always return false. Even pull the source from https://github.com/ribot/AndroidSlidingUpPanel who applied a fix but still the Sliding Panel remain fixed on bottom.

Any ideas??

@gautamverma
Copy link

It was my bad, got it working.

@icangku
Copy link

icangku commented Aug 24, 2018

sliding up panel above navigation drawer how to make it under navigation drawer
error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants