动态设置父活动 [英] Dynamically set parent activity

查看:159
本文介绍了动态设置父活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以此刻我有一个可以从两个不同的活动来达到一个活动,问题是,我只能设置一个活动的清单XML文件中的父活动。显然,这是不好的UX / UI设计,因为该活动可以发送用户返回到了错误的活动,他们在previously所以我想动态设置该活动是父活动。

So at the moment I have an activity that can be reached from two different activities, the problem is that I can only set one activity as the parent activity in the manifest XML file. Obviously this is bad UX/UI design because the activity may send the user back to the wrong activity they were at previously and so I'm trying to dynamically set which activity is the parent activity.

麻烦的是,我不太清楚如何去了解这一点,无论是在code或XML,所以任何指针AP preciated。 :)

The trouble is I'm not quite sure how to go about this, whether in code or XML so any pointers are appreciated. :)

推荐答案

有两个概念,在这里打球上和返回。 返回是显而易见的:带我去哪里我就在我来到了这里。通常你不需要用'回'被关注,因为该系统将处理它就好了。 上是不那么明显 - 这是类似于缩小 - 从一个元素的集合,从细节到更广泛的图片

There are two concepts in play here 'Up' and 'Back'. 'Back' is the obvious one: take me to where I was just before I came here. Usually you don't need to be concerned with 'Back', as the system will handle it just fine. 'Up' is not so obvious - it's analogous to Zoom Out - from an element to the collection, from a detail to the wider picture.

哪一项适合你的使用情况?

Which of these fits your use case?

按下面的评论:向上按钮拉从Android清单的目的,但它可以是的自定义编程的。

As per comment below: the up button pulls the destination from the android manifest, but it can be customized programmatically.

这篇关于动态设置父活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆