获取一个活动的参考从另一个机器人机器人

由网友(划破寂寞的天空)分享简介:我怎样才能获得引用另一项活动,因为我下了动作条的主要活动说 ActivityA ,这个动作条是可见的所有其他活动还有,现在我想访问该的LinearLayout 并使其从隐藏的 ActivityB 。我想要做的财产以后这样的。的LinearLayout栏=(的LinearLayout)ActivityA.findView...

我怎样才能获得引用另一项活动,因为我下了动作条的主要活动说 ActivityA ,这个动作条是可见的所有其他活动还有,现在我想访问该的LinearLayout 并使其从隐藏的 ActivityB

我想要做的财产以后这样的。

 的LinearLayout栏=(的LinearLayout)ActivityA.findViewById(R.id.actionbarhome);
bar.setVisibility(LinearLayout.GONE);
 

我应该在那里的地方 ActivityA 的?任何帮助将是AP preciated。

解决方案   

我怎样才能引用另一个活动

您不知道。

  

现在我要访问此的LinearLayout,并使其从ActivityB隐藏。

1037 报名通道正式开启 第五季博物馆奇妙夜,恐龙少年集结令

没有,你不知道。你想息事宁人。 ActivityA是不可见的,如果ActivityB是在前台。请留下ActivityA孤单。在 onResume() ActivityA,那么只有到那时你担心隐藏操作栏。

How can i get reference to another activity, because i have placed an ActionBar in main activity say ActivityA, this ActionBar is visible on all other activities as well, now i want to access this LinearLayout and make it hidden from ActivityB.

I want to do somthing like this.

LinearLayout bar = (LinearLayout) ActivityA.findViewById(R.id.actionbarhome);
bar.setVisibility(LinearLayout.GONE);

What should be there in place of ActivityA? Any help would be appreciated.

解决方案

How can i get reference to another activity

You don't.

now i want to access this LinearLayout and make it hidden from ActivityB.

No, you don't. You want to leave it alone. ActivityA is not visible if ActivityB is in the foreground. Please leave ActivityA alone. In onResume() of ActivityA, then and only then do you worry about hiding the action bar.

阅读全文

相关推荐

最新文章