我通过程序创建了一个自定义 LinearLayout,其中有一个自定义 TextView。我没有使用 inflater 添加 TextView。现在我想在 XMl 布局中多次使用这个 LinearLayout。但问题是如何在 LinearLayout 中设置这些 TextView 的文本?
有什么想法吗??
最佳答案
如果我理解正确,它会对你有所帮助。祝你好运!
LinearLayout layout = findViewById(id_linear_layout);
((TextView) layout.findViewById(id_textview)).setText("Text");
关于android - 如何在 LinearLayout 中设置 TextView 的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11426798/