从选项卡活动中获取选项卡(父级)视图
我想从选项卡主机内的活动访问在选项卡活动中设置的标题栏。我用什么来称呼家长?到目前为止,我有这个,但它不起作用:
View v = (View) getParent().getTitle();
TextView title = (TextView)v.findViewById(R.id.TitleLabel);
title.setText("Custom Title Text Here");
I am wanting to access the titlebar that was setup in my tab activity from an activity that is within the tabhost. What do I use to call the parent? So far, I have this, but it does not work:
View v = (View) getParent().getTitle();
TextView title = (TextView)v.findViewById(R.id.TitleLabel);
title.setText("Custom Title Text Here");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我所要做的就是在父活动中引用 TextView:
当然,在父活动中将 TextView 设置为公共静态。
All I had to do was reference the TextView within the parentActivity:
And of course, set the TextView to public static in the parent activity.