如何使用android向上滑动面板

前端之家收集整理的这篇文章主要介绍了如何使用android向上滑动面板前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经从 https://github.com/umano/AndroidSlidingUpPanel下载了umano向上滑动面板

将其导入工作区并在我的项目中添加对它的引用.

接下来,我将以下内容复制并粘贴到新布局中 –

这是代码

<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>

但我得到一个错误的未绑定前缀.

我的代码有什么问题?

我该如何解决这个问题?

解决方法

你缺少android的命名空间

还有这个

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

应该

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

所以它应该是

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

考虑到你有自定义属性

编辑:

看起来你正在使用

https://github.com/umano/AndroidSlidingUpPanel

它是一个库项目,您必须在您的andorid项目中引用它.如上所述,Scodnly缺少android命名空间.以下应该解决

<?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>
原文链接:https://www.f2er.com/android/315896.html

猜你在找的Android相关文章