的setText一个动态的另一个活动增加的TextView [英] settext to a dynamic added textview in another activity

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

问题描述

我创建了两个activites,第一个是包含动态添加的TextView,第二个会做一些操作,然后向的setText动态添加TextView的经济活动之一。请大家帮忙提出一个样本code供我参考。谢谢!

I created two activites, the first one is containing the dynamic added textview and the second one will do some operation then settext to the dynamic added textview in activity one. please help to suggest a sample code for my reference. Thank you!

推荐答案

要能够动态地使用下面的方法添加textViews。

To add textViews can dynamically using the following method.

private void addChild(boolean right) {
        LayoutInflater inflater = LayoutInflater.from(this);
        int id = R.layout.unLayout_;
        RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(id, null, false);
        TextView textView = (TextView) relativeLayout.findViewById(R.id.textViewDate);
        textView.setText(String.valueOf(System.currentTimeMillis()));
        layout.addView(relativeLayout);     

}

这篇关于的setText一个动态的另一个活动增加的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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