在Android中,我可以有不同的活动中使用相同的XML文件?不同、文件、活动中、Android

由网友(傲气稳情场)分享简介:我创建一个Android应用程序,将有多个页面具有相同的布局,但改变将是(使用的setText)显示在顶部的字符串的唯一的事。我可以使用这些网页一个XML文件,还是安卓不允许呢? I'm creating an android app that will have multiple pages with the sa...

我创建一个Android应用程序,将有多个页面具有相同的布局,但改变将是(使用的setText)显示在顶部的字符串的唯一的事。我可以使用这些网页一个XML文件,还是安卓不允许呢?

I'm creating an android app that will have multiple pages with the same layout, but the only thing that changes will be a string that is displayed on the top (using setText). Can I use a single xml file for these pages, or does Android not allow that?

推荐答案

是的,你可以。只要打电话的setContentView具有相同的XML,它会使用相同的布局。更改任何你需要以编程方式在运行时。

Yes, you can. Just call "setContentView" with the same xml and it will use the same layout. Change whatever you need to programmatically during runtime.

阅读全文

相关推荐

最新文章