ANDROID-单击按钮时显示列表视图
我想在片段上创建一个ListView 该列表视图必须是“隐藏”的,并且只有在我点击按钮时才会显示 附上我需要知道的照片ANDROID-单击按钮时显示列表视图,android,listview,android-listview,Android,Listview,Android Listview,我想在片段上创建一个ListView 该列表视图必须是“隐藏”的,并且只有在我点击按钮时才会显示 附上我需要知道的照片 如果我点击中心按钮(箭头按钮),就会出现一个列表视图 自下而上 如果我再次单击箭头按钮,ListView将再次隐藏 我不需要打开新活动,我需要相同活动的列表视图,但我不知道如何显示列表视图和隐藏 你能帮我吗?你需要使用MotionEvent 通过entendSimpleOnGestureListener创建一个类。 您可以在此找到教程参考资料 您可以使用该类并将列表视图包
你能帮我吗?你需要使用
MotionEvent
通过entendSimpleOnGestureListener
创建一个类。
您可以在此找到教程参考资料您可以使用该类并将
列表视图
包含在单独的布局中,该布局将充当将要向上滑动的内容的容器
在您的活动中
,假设内容视图为:main\u layouti、 e.
setContentView(右布局、主布局)代码>
然后在主布局中包括抽屉,如:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
arrow to open />
<package.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/yourpackageforslider"
android:id="@+id/drawer"
//here you specify the direction
my:direction="bottomToTop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
my:handle="@+id/handle" //this is the button -arrow
my:content="@+id/content" -content (which would identify your listview layout)>
<include
android:id="@id/content"
layout="@layout/layoutContainingYourListview" />
<ImageView
android:id="@id/handle"
button for it to push it up/down />
</package.MultiDirectionSlidingDrawer>
</RelativeLayout>
您的listView
将保持完全独立于上面的代码,并处于不同的布局中——布局包含您的listView。这是很好的,因为抽屉向上滑动变得与内容无关-您也可以动态更改和使用内容 无论你尝试了什么,都可以发布一些代码…你需要像滑动一样的动画listview吗?@RamkiAnba不,我不需要那个菜单中的动画listview按钮在左边,你只需要把它放在底部