Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use android sliding up panel

Tags:

android

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 ?

like image 549
Opax Web Avatar asked Apr 08 '14 05:04

Opax Web


2 Answers

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>
like image 114
Raghunandan Avatar answered Nov 17 '22 03:11

Raghunandan


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

like image 35
andri_sasuke Avatar answered Nov 17 '22 03:11

andri_sasuke