如何使一个字一个完整的文本视图点击机器人(未网址链接) [英] how to make a word in a complete text view clickable android(not url link)

查看:178
本文介绍了如何使一个字一个完整的文本视图点击机器人(未网址链接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我知道有数百个关于这个职位仍处于计算器的帖子,我没有找到我合适的答案。所以,我要求它作为新的问题。

Although I know there are hundreds of posts in stackoverflow regarding this post still, I did not found my appropriate answer. So I am asking it as new question.

问题: -
我在文本视图文本您需要的饼干或香蕉吃?我想,如果香蕉,饼干的点击则只有就应该到厨房屏幕。如果其他文字点击它不应该反应。

Problem:- I have a text in text view "You need cookies or banana to eat?" I want that if any one click on banana or cookies then only it should go to Kitchen screen. If clicked on other word it should not react.

我尝试: - 我从文字来看,做机器人:可点击=真正的,但整条生产线获得点击。
所以,我决定把它分解成各种文本的意见,并用相对布局但同样的是,整条生产线并没有在screen.When我很难$ C $光盘,它的中心来为 Android的一个问题:layout_marginLeft =150dp但随后缩进扰乱了纵向和横向。显然我们不应该硬code的值。除此之外,给一个明确的说法给用户,我需要做一些格式香蕉和饼干一样大胆,并强调和一些色彩。虽然我使用和标签的大胆和下划线,如何着色的文本。

My Try:- I am doing it from text view, android:clickable="true" but complete line is getting clickable. So I decided to break it into various text views, and used relative layout but again there was a problem that complete line was not coming in center of screen.When I hard coded it as android:layout_marginLeft="150dp" but then indentation disturbs for portrait and landscape. and obviously we should not hard code the values. Apart from that to give a clear view to user I need to do some formatting to banana and cookies like bold and underlined and some color. Although I used and tag for bold and underline, how to color the text.?

最后,我应该总结我的问题,因为

Lastly I should summarize my problems as

1)如何使一些字在一个完整的字符串可点击(而不是URL链接)

1) How to make some word in a complete string clickable (not url links)

2)如何做完整的字符串的一些文字格式。

2) How to do formatting of few text of complete string.

3)如果相对布局是用来如何保持在中心整个字符串。

3) If relative layout is used how to keep the entire string in center.

如果任何其他方法可以B中他们也受到了欢迎。

If any other approach can b used they are also welcomed

一点要注意,这些都是不是URL链接,但在内部屏幕。
所以,请,如果任何人能提供帮助。
任何帮助将AP preciated。先谢谢了。

Point to note that these all are not url links but internal screens. So please if any one could help. Any help will be appreciated. Thanks in advance.

推荐答案

您好AddingKnowledge。

Hello AddingKnowledge.

什么ü可以做的是定义你的线性布局相对布局内,将提供ü一定的灵活性。
除此之外,款式可以通过string.xml完成​​。或者你可以从style.xml做造型,这就是为什么style.xml是存在的。

What u can do is to define your linear layout inside relative layout, that will provide u some flexibility. Apart from that style can be done through string.xml. Or you can do styling from style.xml and that is why style.xml is there.

如果你愿意,你可以去为链接<一个href=\"http://stackoverflow.com/questions/9076349/how-to-make-a-text-clickable-like-button-in-android\">How使文本可点击像Android的按钮?的一些较深的造诣。或<一个href=\"http://stackoverflow.com/questions/1697084/handle-textview-link-click-in-my-android-app\">handle TextView的链接点击我的Andr​​oid应用

If you want you can go to link as How to make a text clickable like button in android? for some deeper knowledge. Or handle textview link click in my android app

这篇关于如何使一个字一个完整的文本视图点击机器人(未网址链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆