我有一个 string resource
:
<string name="dialog"> text + 800-800-800 + text</string>
800-800-800
- 是电话号码
我用这个string
在我的 Dialog
:
问题是:如何使电话号码可点击和onClick
调用此号码并通过电话调用?
我知道怎么做hyperlink
使用 html <a href="">
标记,制作 TextView
可点击和setMovementMethod()
并从 textview
导航到网站但还有另一种情况,我需要这样的行为 Intent.ACTION_DIAL
.
我的想法来自于我的 string
3 个不同的字符串,中间为 string
设置电话号码 Onclick
听众,但我认为这是解决方法,也许有更好的方法来回答我的问题?
希望我能清楚地解释我的问题。谢谢!
最佳答案
使用 ClickableSpan 使字符串可点击 onClick
http://developer.android.com/reference/android/text/style/ClickableSpan.html
本页解释了解决方案: How to set the part of the text view is clickable
祝你好运!
关于android - 使 String 资源中的 phoneNumber 在对话框中可单击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35081300/