页面布局的xml文件都放在了网上,要先从网上读取出来,再去用,如果不有更新的话,又要随时更新。
   有什么思路??

解决方案 »

  1.   

    这个有点太扯了吧。没戏啊,xml这玩意不能在运行的时候换的吧。要不就是我小白了
      

  2.   

    写一个manager.xml 
    大体内容
    <?xml version="1.0" encoding="UTF-8"?><Preference xmlns:android="http://schemas.android.com/apk/res/android"> <update> <revision></revision> <description></description> <timestamp></timestamp> <changelist> <change></change> </changelist> </update></Preference>
    工程中写入一个revision号,每次运行时,下下来解析比对revision,有更新就更新changelis中的东西,当然有写服务器端的话可以返回个json。(我的想法,紧供参考)
    工程中记录一个工程
      

  3.   

        看你怎么应用吧   如果每次都下载有更新的布局文件(整个布局) 就做一个配置文件,每次更新后就把更新的布局文件的名称和路径配置到该文件。    然后用C2DM(Cloudto Device Messaging)通知android客户端(C2DM实现比较麻烦)。   但是如果想每次只下载有变动的布局文件的有变动的标签  思路也和上面一样  不过考虑的问题超多。。 实现起来比较繁琐   
      

  4.   

    怎样在setContentView()中引用到它呢
      

  5.   

    这种情况貌似不好用setContentView来引用吧
      

  6.   

    是啊,实时更新都不是太大的问题,关键是怎样把你下载下来的配置文件引入里面,要放在layout文件夹下,它才会生成Id啊,不知道可不可以实现
      

  7.   

    你不怕麻烦我教你吧。开始下载xml。解析xml,获取控件和数据。用代码把控件和数据都写出来。是用代码哦,在把这些添加进一个布局文件,然后setContentView这个布局文件。。好吧,你这样做网络不好的话界面都出不来。还不能去开线程获取xml数据,因为你的界面需要这些数据,没获取到界面就要出来但是没有数据。哦啦。就出错了。当然你可以选择获取到数据以后更新界面。
      

  8.   

    应该是可以的,看这个:
     View android.view.LayoutInflater.inflate(XmlPullParser parser, ViewGroup root)
    Inflate a new view hierarchy from the specified xml node. Throws InflateException if there is an error. * Important   For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime.Parameters:
    parser XML dom node containing the description of the view hierarchy.
    root Optional view to be the parent of the generated hierarchy.
    Returns:
    The root View of the inflated hierarchy. If root was supplied, this is the root View; otherwise it is the root of the inflated XML file.
    不过这个xml和我们平时定义的会不太一样,其中的那些参数常量应该只能直接使用数字了吧,而且不是太有效率