Android 如何使用安卓向上滑动面板
我已经从下载了umano向上滑动面板 将其导入工作区并在我的项目中添加对它的引用 接下来,我将以下内容复制并粘贴到新布局中- 代码如下:Android 如何使用安卓向上滑动面板,android,Android,我已经从下载了umano向上滑动面板 将其导入工作区并在我的项目中添加对它的引用 接下来,我将以下内容复制并粘贴到新布局中- 代码如下: <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_
<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"
您将获得未绑定前缀错误意味着您已经完成了对库的引用,您只需修改xmlns属性并将slidengppannellayout设置为根,就完成了。不要忘了将“com.example.slidinguppanel”更改为您的包名。
希望它能解决你的问题
<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>
我还实现了基于SlidingPanel布局的SlidingPaneLayout,但滑动方向是
垂直您可以在俯视图上下滑动,更简单,只需两个视图,无需设置更多属性。请参阅github
您可以使用谷歌android支持库中的BottomSheetBehavior作为替代方案<代码>编译'com.android.support:design:25.0.0'
如果您想将主体与滑动部件一起滑动,则只需添加,即可签出我的样本 UmanOparlaxOffset属性,否则将其删除
<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>
//主体内容
正文。。。。。。。。。。。
//滑动内容
正文。。。。。。。。。。。
别忘了!
sothree:umanoOverlay=“true”
真的
你能发布logcat错误吗?android的名称空间在哪里?嗨,Jishi Chen,如何限制顶部视图高度。我只想将俯视图拖动到屏幕的一半screen@PrabhuM在SlidingUpPaneLayout.java中,您可以更改私有静态final int DEFAULT\u overnang\u SIZE=32;//数据处理我猜,根据你在code SlidengUppaneLayout.java中的评论,默认的悬垂大小将使滑动窗格至少有这么大的部分保持可见,以表明有更多的内容可用。但是,我要问的是,当我拖动向上滑动面板时,它应该停在屏幕的一半(或250dp高度),而不是覆盖整个屏幕lot@JishiChen我和帕布有同样的问题。您的代码不允许拖到屏幕的一半。你能告诉我们怎么做吗。prabhu的问题:“我猜,根据你在code SlidengUppaneLayout.java中的评论,默认的悬垂大小将使至少这么多的滑动窗格保持可见,以表明有更多的内容可用。但是,我想问的是,当我拖动向上滑动的面板时,它应该停在屏幕的一半(或250dp高度)而不是覆盖整个屏幕。“@windupurnomo它应该be@Raghunandan我可以设置slidengappannellayout
Center default state吗???@IntelliJAmiya我不明白你说的Center default state是什么意思。@Raghunandan Ji好的。我能把这变成唯一的中央和最高状态吗?@IntelliJAmiya我很久没有使用过这个库了。我想这是可能的。我得试试
<?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>
<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>
<style name="AppTheme">
<item name="android:windowActionBarOverlay">true</item>
</style>