关于视图将 Java 移植到 Android
我有一个java应用程序(我想将其移植到Android上),它严重依赖于java.awt
,我想知道以下内容可以有哪些替代方案:
- java.awt.BasicStroke
- java.awt.Cursor
- java.awt.Graphics
- java.awt.Graphics2D
- java.awt.geom.Line2D
- java.awt.geom.Rectangle2D
其中一些有 Android 等效项吗?我对 Android 开发非常陌生,想知道会发生什么。欢迎所有意见和建议
I have a java application (that I'm wanting to bring over to Android) that relies heavily on java.awt
and I'm wondering what some alternatives could be to the following:
- java.awt.BasicStroke
- java.awt.Cursor
- java.awt.Graphics
- java.awt.Graphics2D
- java.awt.geom.Line2D
- java.awt.geom.Rectangle2D
Are there Android equivalents for some of these? I am very new to Android development and wanted to know what to expect. All comments and suggestions are welcome
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 graphics 包
Take a look at the graphics package
这个包在这里不起作用。您必须使用 XML 设计 UI。您可以使用两种基本方法在 android 中开发 UI,即过程式(java 代码)和声明式(XML 代码)。尝试按照这两种方法编写代码,并尝试根据 awt 包在 java 代码中执行的操作来编写代码。
This packages wont work here. You have to design the UI in XML. You can develop the UI in android using two basic approach i.e procedural(java code) and declarative(XML code). Try to write a code following this two approaches and try to write in respect to what your awt packages are doing in your java code.