接收XML文件,使他们的Andr​​oid应用程序 [英] Android application that receives XML files and renders them

查看:126
本文介绍了接收XML文件,使他们的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想,如果有可能运行在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 desired View hierarchy from the XML, the actual rendering would be no different than if the layout had been inflated from a resource.

这篇关于接收XML文件,使他们的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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