接收XML文件,使他们的Android应用程序 [英] Android application that receives XML files and renders them
问题描述
我在想,如果有可能运行在Android上的应用程序运行,而这些新收到的XML文件将被渲染到屏幕(将显示为布局/视图/串)期间将接收XML文件。
我在想,也许你可以在新接收到的XML文件添加到您的res文件夹,但我不认为它会改变很多,因为当应用程序已经编译生成的R舱将不会被更新。
我也想过实现我自己的XML解析和渲染的,但是这将pretty多像rewritting了Android的整个渲染机制。
需要帮助!
然后它会显示在屏幕上采用了Android渲染XML数据(它应该呈现它,就好像home_layout.xml在res文件夹)
块引用>
LayoutInflater
不支持什么,但布局资源。您将需要从头开始编写自己的布局通胀的逻辑。既然你从XML创建所需的查看
层次,实际的渲染就没有什么不同,如果布局已经从一个资源夸大了。I was wondering if it was possible to run an application on Android that will receive XML files during runtime, where these newly received XML files will then be rendered to the screen (will be shown as layout/view/string).
I was thinking that maybe you could add the newly received XML file to your res folder, but I don't think it'll change much since the generated R class will not be updated when the application is already compiled.
I have also thought of implementing my own XML parsing and rendering, but that would pretty much be like rewritting the entire render mechanism of Android.
Need help!
解决方案It will then display on screen the XML data using Android rendering (it should render it as if home_layout.xml was in the res folder)
LayoutInflater
does not support anything but layout resources. You would need to write your own layout inflation logic from scratch. Given that you create your desiredView
hierarchy from the XML, the actual rendering would be no different than if the layout had been inflated from a resource.这篇关于接收XML文件,使他们的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!