【发布时间】:2015-11-07 22:25:36
【问题描述】:
您好,我试图更改另一个 xml 的 textview 的内容。 不幸的是它不起作用,我的代码如下所示:
View inflatedView = getLayoutInflater().inflate(R.layout.fragment_main, null);
TextView testView= (TextView) inflatedView.findViewById(R.id.section_label);
TextView test = (TextView) inflatedView.findViewById((R.id.testext));
testView.setText("adasd");
test.setText("adjhsajdH");
有谁知道解决办法。
【问题讨论】:
-
这段代码到底在哪里,在监听器中
-
在 if 语句中
-
您能否发布完整代码并检查 if 语句是否正常工作
-
如果语句有效,我放了一个 console.log
-
如果你没有提供完整的代码和xml文件,我帮不了你
标签: java android xml textview android-inflate