Theoretical question: load external XML-Layout file in Android

前端 未结 4 551
名媛妹妹
名媛妹妹 2021-01-02 04:10

I thinks it\'s probably not possible for security reason but just want to be sure: is it possible to create layout in Android from an external XML file?

To be exactl

4条回答
  •  囚心锁ツ
    2021-01-02 04:36

    Of course you can create Views dynamic at runtime, while I'm not shure, that this is the best solution. If you have a look at the internals of Android, every View which is created through XML is called with a Constructor with two parameters: Context and - even more interesting for you - an AttributeSet. I think you have a lot of work with parsing it, while keeping track of the right format. You could at least set the values and build your views yourself in Java depending on Server output.

提交回复
热议问题