如何使用Android的向上滑动面板 [英] how to use android sliding up panel

查看:189
本文介绍了如何使用Android的向上滑动面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了umano从<一个向上滑动面板href="https://github.com/umano/AndroidSlidingUpPanel">https://github.com/umano/AndroidSlidingUpPanel

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 -

下面是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>

但我得到一个错误绑定preFIX。

But I am getting an error unbound prefix.

什么是错误的,我code?

What is wrong in my code?

和我怎样才能解决这个问题?

And How can i fix this ?

推荐答案

您缺少命名为Android

You are missing namespace for android

另外这款

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

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

编辑:

看起来你正在使用

<一个href="https://github.com/umano/AndroidSlidingUpPanel">https://github.com/umano/AndroidSlidingUpPanel

它的库项目,你必须引用它在你的Andorid项目。 Scodnly失踪提到的Andr​​oid命名空间。下面应该修复它

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>

这篇关于如何使用Android的向上滑动面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆