拖动 SlidingDrawer 时调用 Activity
我需要创建一个具有由 GridView
和 SlidingDrawer
组成的 activity
的应用程序。
我已经做到了,但现在我的问题是,每当拖动 SlidingDrawer
时,我都需要为屏幕的一半带来一个 Activity,而另一半将是我之前的 activity
当我拖回 SlidingDrawer
时,Activity
应该关闭。
是否可以在不发生任何冲突的情况下处理屏幕中的两个活动?如果可能,我应该如何设计这些活动?
I need to make an application with an activity
consisting of a GridView
and SlidingDrawer
.
I have done that, but now my problem is that I need to bring an activity for half of the screen whenever the SlidingDrawer
is dragged and the other half will be my previous activity
and when I drag back the SlidingDrawer
then the Activity
should be closed.
Is this possible to handle both the activities in the screen without any conflict and if possible how should I design those activities?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能将
Activity
放入SlidingDrawer
中。您可以将View
放入SlidingDrawer
中。You cannot put an
Activity
in aSlidingDrawer
. You can put aView
in aSlidingDrawer
.SlidingDrawer
的所有者Activity
应扩展ActivityGroup
。获取目标 Activity 的视图,将视图添加到
SlidingDrawer
的内容中。代码如下:注意: 决不
startActivity(pkg, YourTargetActivity)
!这样用户就永远不会将 YourTargetActivity 作为独立的Activity
。Activity
of yourSlidingDrawer
should extendsActivityGroup
.Get the view of the target activity, add view to
SlidingDrawer
's content. Code like below:NOTE: NEVER
startActivity(pkg, YourTargetActivity)
! So that the user never goes to YourTargetActivity as a stand-aloneActivity
.