使用 Graphics 在 Android 中构建自定义界面
我希望你能引导我找到好的链接,或者给我一些我必须学习和阅读的基本元素,以便能够在 android 中构建自定义用户界面。 我所说的自定义是指界面将包含图像按钮,而不是常规的 Android 按钮。 此外,我还必须根据用户操作动态生成自定义按钮,并且这些生成的按钮应该具有与其关联的事件。
I want you to direct me to good links or give me the basic elements that I have to study and read about to be able to build a custom user interface in android.
What I mean by custom is that the interface will contain buttons that are images not a regular android button.
Also I have to generate custom buttons on the fly based on user action and those generated buttons should have events associated with them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关按钮的通用信息此处
要使用按钮的图像,您需要一个 < a href="http://developer.android.com/reference/android/widget/ImageButton.html" rel="nofollow">android.widget.ImageButton。可绘制选择器的示例(将其放在 res/drawable/ 中):
因此您可以针对不同的状态使用不同的图像。
要动态生成按钮,您可以使用任何布局管理器(FrameLayout、RelativeLayout、LinearLayout)定义基本布局,在 Activity 中通过 id (findViewById()) 找到它并使其可见:
希望这会有所帮助。
Generic info about buttons here
To use image for a button you need an android.widget.ImageButton. Example of drawable selector (put it in res/drawable/):
So you can use different images for various states.
To generate buttons on the fly you can define base layout with any layout manager (FrameLayout, RelativeLayout, LinearLayout), find it by id (findViewById()) within your Activity and make it visible:
Hope this helps.