Opax Web
Opax Web

Reputation: 918

how to use android sliding up panel

I have downloaded the umano sliding up panel from https://github.com/umano/AndroidSlidingUpPanel

Imported it into the workspace and added reference to it in my project.

Next I copied and pasted the following into a new layout -

Here is the Code :

<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"
    sothree:panelHeight="68dp"
    sothree:shadowHeight="4dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Main Content"
        android:textSize="16sp" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center|top"
        android:text="The Awesome Sliding Up Panel"
        android:textSize="16sp" />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

But I am getting an error unbound prefix.

What is wrong in my code?

And How can i fix this ?

Upvotes: 11

Views: 27910

Answers (5)

Shaikh Mohib
Shaikh Mohib

Reputation: 288

If you want to slide your main body along with sliding part then only then add umanoParallaxOffset attribute otherwise remove it

<com.sothree.slidinguppanel.SlidingUpPanelLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/hidden_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:gravity="bottom"
sothree:umanoClipPanel="false"
sothree:umanoDragView="@+id/dragView"
sothree:umanoFadeColor="@android:color/transparent"
sothree:umanoOverlay="true"
sothree:umanoPanelHeight="@dimen/_69sdp"
sothree:umanoShadowHeight="@dimen/_4sdp">

//Main body content

<FrameLayout
    android:id="@+id/main_panel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

        Body...........

</FrameLayout>

//Sliding content

<FrameLayout
    android:id="@+id/main_panel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

        Body...........

</FrameLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>  

Don't forget it! sothree:umanoOverlay="true"

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

Upvotes: 1

andri_sasuke
andri_sasuke

Reputation: 207

You can use BottomSheetBehavior from android support library from google as alternative. compile 'com.android.support:design:25.0.0' You can checkout my sample https://github.com/andrisasuke/Android-SlidingUp-Panel

Upvotes: 3

Jishi Chen
Jishi Chen

Reputation: 634

I also implemented a SlidingUpPaneLayout, based on the SlidingPaneLayout, but the slide direction is vertical you can slide up and down for the top view, it's more simple,just two views and no more attribute need to set.see at github,https://github.com/chenjishi/SlidingUpPaneLayout

<?xml version="1.0" encoding="utf-8"?>
<com.chenjishi.slideupdemo.SlidingUpPaneLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sliding_up_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<LinearLayout
        android:id="@+id/bottom_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:background="#FFF"
        android:orientation="vertical">
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="BOTTOM"
            android:textSize="18sp"
            android:textColor="#333"/>
</LinearLayout>
<LinearLayout
        android:id="@+id/top_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:background="#009588"
        android:orientation="vertical">
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TOP"
            android:textSize="18sp"
            android:textColor="#333"/>
</LinearLayout>

enter image description here

Upvotes: 2

RQube
RQube

Reputation: 954

you are getting unbound prefix error means you are done with referencing the library, you just need to modify xmlns attributes and make the slidingUpPanelLayout the root and you are done. dont't forgot to change "com.example.slidinguppanel" with your package name. Hope it will fix your problem.

<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res/com.example.slidinguppanel"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:panelHeight="68dp"
sothree:shadowHeight="4dp">

<TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:text="Main Content"
    android:textSize="16sp" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center|top"
    android:text="The Awesome Sliding Up Panel"
    android:textSize="16sp" />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

Upvotes: 0

Raghunandan
Raghunandan

Reputation: 133570

You are missing namespace for android

Also this

xmlns:sothree="http://schemas.android.com/apk/res-auto"

Should be

xmlns:sothree="http://schemas.android.com/apk/res/yourpackagename"

So it should be

<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res/yourpackagename"

considering you have custom attributes

Edit:

Looks like you are using

https://github.com/umano/AndroidSlidingUpPanel

Its a library project and you must reference it in your andorid project. Scodnly missing android namespace as mentioned. The below should fix it

<?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=".MainActivity" >
<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"
    sothree:panelHeight="68dp"
    sothree:shadowHeight="4dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Main Content"
        android:textSize="16sp" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center|top"
        android:text="The Awesome Sliding Up Panel"
        android:textSize="16sp" />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>

Upvotes: 8

Related Questions