问题描述:

Hey i am really new to this so sorry if this is a stupid question. I created an android application and my goal is to make it into a PC application and i believe this to be possible without to much trouble since they can both be written in java.

So my main question is in android application we used the XML files for the user interface. While in the pc application we would need to use jframes. I have been looking around im not sure if its parsing or i need something else i am very confused. i was hoping i can use the XML as a file which will create my user interface and my program would just be in the java files like a android application or is that not possible? confused by what people have been saying about parsing, i checked out some examples and it just seems they just get some information from xml but dont use it for the actual layout.

any help will be great.

网友答案:

I don't think that a conversion utility exists, and I don't believe that it would be easy or even reasonably possible since the library and use structure of Swing vs. Android is so different from each other.

What you need to do is to be sure that your program adheres strongly to an MVC (Model-View-Control) type of structure so that the same or similar model can be used in both programs. But again because the library and use structure of Swing vs. Android is so different I strongly believe that there is no way to share view or control code or to easily convert from one to another.

相关阅读:
Top