Android的==>分活动?Android、GT

由网友(Absurd(荒谬))分享简介:是否有可能增加一个活动上的当前活动的顶部。例如,假设我点击一个按钮,然后将其添加第二个活动,以当前的活动。而第二项活动只涉及在我当前活动的BUTTOM一个小地方。Is it possible to add an activity on top of the current activity.For example...

是否有可能增加一个活动上的当前活动的顶部。 例如,假设我点击一个按钮,然后将其添加第二个活动,以当前的活动。而第二项活动只涉及在我当前活动的BUTTOM一个小地方。

Is it possible to add an activity on top of the current activity. For example lets say i click a button, and then it adds a second activity to the current activity. And the second activity only covers a small place at the buttom of my current activity.

推荐答案

该活动只显示一个窗口,让你可以使用getWindow()来修改窗口PARAMS是我们想要的东西 - 包装内容,而不是填充母例如。尽管对于未将是全屏的活动,你首先应该做的安卓主题=@安卓风格/ Theme.Dialog在你的清单。这本身就会使活动看起来像一个对话框(对话框架和包装中心的屏幕上的内容)。你可以从那里进一步细化风格或布局PARAMS。

The activity is just displaying a window, so you can use getWindow() to modify the window params to be what we want -- wrap content instead of fill parent for example. Though for an activity that is not going to be full screen, you should first do android:theme="@android:style/Theme.Dialog" in your manifest. That by itself will make the activity look like a dialog (dialog frame and wrap content centered on the screen). You can further refine the style or layout params from there.

这就是说,要认识到,设计是,有在一个时间只运行一个活动是重要的。所以,当你表现出这一新的活动,你当前会被暂停。 (它不会停止,因为它仍然落后于你的非全屏活动可见。)对于集成度更高的东西,只是有基础的活动创建一个对话框,并根据需要以同样的方式调整其窗口。其中大约要使用的仅仅是一个问题的决定更适合您的设计,但我认为对话是更常见的做法在这里。

That said, it is important to realize that the design is that there is only one activity running at a time. So when you show this new activity, your current one will be paused. (It won't be stopped because it is still visible behind your non-fullscreen activity.) For more integrated things, just have the base activity create a Dialog and adjust its window as desired in the same way. The decision about which to use is just a matter of which is more appropriate for your design, though I think a Dialog is a far more common approach here.

阅读全文

相关推荐

最新文章