如何在Android中创建圆形电话屏幕?
我是 Android 新手,我想创建圆形电话拨号屏幕? 那么如何创建屏幕呢?哪些组件需要使用LinearLayout
/FrameLayout
/RelativeLayout
,以及如何设置所有分辨率的图像?
I am new to Android and I want to create a Round Telephone dialing screen?
so how to create a screen? Which component need to use LinearLayout
/FrameLayout
/RelativeLayout
, and how to set images for all resolution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我是您,我会考虑创建您自己的自定义 UI 组件。可以在此处找到文档 Android 自定义组件。
您可以使用 onDraw() 方法来绘制椭圆以及您需要的几乎任何其他内容。然后可能添加这些数字以形成拨号盘。您可以通过 onDraw() 输出文本。 老式温度计教程 这实际上绘制了一个带有刻度的圆形温度计,因此它可能会让您完成 65%,同时提供良好的学习体验。您需要去掉与传感器相关的东西,但这并不太困难。
至于拨号,我不太确定,尽管我会存储在活动中某处按下的数字,然后有一个“拨号”按钮,按下该按钮时会执行类似的操作,
尽管使用上述内容,用户可能必须在您的应用程序/小部件上按拨号然后再次在实际拨号屏幕上填写号码。这里的某人可能可以添加一些附加信息,但我还没有看到任何建议您可以在用户不明确按手机拨号应用程序上的拨号键的情况下拨打号码。
您还需要在清单中获得此许可:
我希望这能让您的项目顺利进行。如果您遇到困难,我建议您先拨打电话,然后整理自定义 UI。
If I were you I would look into creating your own custom UI component. The documentation can be found here Android Custom Components.
You can use the onDraw() method to draw ellipses and pretty much anything else you need. Then potentially add the numbers to form a dial pad. You can output text via onDraw(). Something that might help is the Vintage Thermometer Tutorial this actually draws a round thermometer with numbers on a scale, so it might get you 65% of the way there, while providing a good learning experience. You'll need to strip out the sensor related stuff however that is not too difficult.
As for the dialing, I am not too sure although I would store the numbers pressed somewhere in the activity then have a "dial" button that when pressed does something like
Although with the above the user might have to press dial on your app/widget then again on the actual dial screen where the number will have been populated. Someone here might be able to add some additional information but I haven't seen anything yet to suggest you can dial a number without the user explicitly pressing dial on the phone's dialing app.
You will also need this permission in your manifest:
I hope this gets your project underway. If you are struggling I would suggest you start with making a call then sort out the custom UI.