Code Monkey home page Code Monkey logo

Comments (6)

Hesamedin avatar Hesamedin commented on June 17, 2024 2

Thanks for your awesome app :)

I had same problem and based on what #rendecano said, I fixed the issue.
For those who don't know how to get view add following line after the place you linked slider to your activity (or FragmentActivity):

mPanelLayout.setDragView(this.findViewById(R.id.NAME_OF_VIEW));

complete code in activity:

SlidingUpPanelLayout mPanelLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
        mPanelLayout.setShadowDrawable(getResources().getDrawable(R.drawable.above_shadow));
        mPanelLayout.setAnchorPoint(0.4f);
        mPanelLayout.setDragView(this.findViewById(R.id.ivPullUp));
...

If you want to use two fragment (one as main and another one inside slide) this is my sample code:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".AroundMeActivity">

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

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

        <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

            <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_pull_up"
                    android:scaleType="fitCenter"
                    android:id="@+id/ivPullUp"
                    android:background="@color/map_slider_header"
                    android:contentDescription="@string/content_description"/>

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

</RelativeLayout>

Then you can add your fragments from your FragmentActivity:

// add map fragment to activity
        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.frame_main, new AroundSpotsMapFragment(), FRAG_AROUND_SPOTS_MAP)
                .commit();

        // add list fragment to activity
        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.frame_slider, new AroundSpotsListFragment(), FRAG_AROUND_SPOTS_LIST)
                .commit();

Following image shows final result:
01

from androidslidinguppanel.

anandraj16992 avatar anandraj16992 commented on June 17, 2024 1

Hello,

mPanelLayout.setDragView(this.findViewById(R.id.ivPullUp));

This method is not working for me. I have tried to set my whole view as dragview still it's not working. Please update for same.

from androidslidinguppanel.

sothree avatar sothree commented on June 17, 2024

Have a look at the setDragView method. If you want to have clickable
objects, you need to have a separate drag view.

On Tue, Jun 11, 2013 at 7:22 PM, rendecano [email protected] wrote:

Hi,

First of all, thanks for this one. =)

I just wanna ask, I tried running the Demo app included in the project and
then added some buttons inside the sliding panel but I can't click on the
buttons, but instead the panel keeps on hiding.

Am I missing something here?

Thanks and regards!


Reply to this email directly or view it on GitHubhttps://github.com//issues/2
.

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

from androidslidinguppanel.

rendecano avatar rendecano commented on June 17, 2024

Hi,

Thanks for the quick reply. It's now working great! =)

Just a suggestion, maybe we can update the "Usage" part of the documentation? ;)

Thanks and regards!

from androidslidinguppanel.

tokudu avatar tokudu commented on June 17, 2024

Will do!

On Tue, Jun 11, 2013 at 8:18 PM, rendecano [email protected] wrote:

Hi,

Thanks for the quick reply. It's now working great! =)

Just a suggestion, maybe we can update the "Usage" part of the
documentation? ;)

Thanks and regards!


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

from androidslidinguppanel.

tokudu avatar tokudu commented on June 17, 2024

Yes. That's correct. Make sure that the drag view is the child in the
sliding panel's layout.

On Sun, Sep 8, 2013 at 6:56 AM, linusmotu [email protected] wrote:

Hi,

I just started using this library (thanks for this), but i am having the
same problems with the items inside the panel. How exactly do I use
setDragView?

For example, I have a button or textview inside the panel, I am doing this
but it is not working, it still wont let me click the button.
t = (TextView) findViewById(R.id.DisplaySettings);
layout.setDragView(t);

Am I correct in thinking that when I use this, i should be able to drag
the text view, and only that, while everything else in the panel is
clickable?

Thank you!


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

from androidslidinguppanel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.