如何使用android向上滑动面板

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

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

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

这是代码

  1. <com.sothree.slidinguppanel.SlidingUpPanelLayout
  2. xmlns:sothree="http://schemas.android.com/apk/res-auto"
  3. android:id="@+id/sliding_layout"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:gravity="bottom"
  7. sothree:panelHeight="68dp"
  8. sothree:shadowHeight="4dp">
  9.  
  10. <TextView
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent"
  13. android:gravity="center"
  14. android:text="Main Content"
  15. android:textSize="16sp" />
  16.  
  17. <TextView
  18. android:layout_width="match_parent"
  19. android:layout_height="match_parent"
  20. android:gravity="center|top"
  21. android:text="The Awesome Sliding Up Panel"
  22. android:textSize="16sp" />
  23. </com.sothree.slidinguppanel.SlidingUpPanelLayout>

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

我的代码有什么问题?

我该如何解决这个问题?

解决方法

你缺少android的命名空间

还有这个

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

应该

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

所以它应该是

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

考虑到你有自定义属性

编辑:

看起来你正在使用

https://github.com/umano/AndroidSlidingUpPanel

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

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:tools="http://schemas.android.com/tools"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. tools:context=".MainActivity" >
  7. <com.sothree.slidinguppanel.SlidingUpPanelLayout
  8. xmlns:sothree="http://schemas.android.com/apk/res-auto"
  9. android:id="@+id/sliding_layout"
  10. android:layout_width="match_parent"
  11. android:layout_height="match_parent"
  12. android:gravity="bottom"
  13. sothree:panelHeight="68dp"
  14. sothree:shadowHeight="4dp">
  15.  
  16. <TextView
  17. android:layout_width="match_parent"
  18. android:layout_height="match_parent"
  19. android:gravity="center"
  20. android:text="Main Content"
  21. android:textSize="16sp" />
  22.  
  23. <TextView
  24. android:layout_width="match_parent"
  25. android:layout_height="match_parent"
  26. android:gravity="center|top"
  27. android:text="The Awesome Sliding Up Panel"
  28. android:textSize="16sp" />
  29. </com.sothree.slidinguppanel.SlidingUpPanelLayout>
  30. </RelativeLayout>

猜你在找的Android相关文章