使我的文本的特定部分可点击
To make a particular part of my text clickable
我正在尝试使文本的特定部分可以点击。例如,请看下图:
在这张图片中,"www.google.com" 被放置在一个可展开的列表视图中。
任何人都可以帮助我如何使此文本可点击以便它重定向到其相应的网页
ArrayList<String> groupItem = new ArrayList<String>();
ArrayList<Object> childItem = new ArrayList<Object>();
public void setGroupData() {
groupItem.add("About");
groupItem.add("General Information");
groupItem.add("Contact");
}
public void setChildGroupData() {
/**
* Add Data For TecthNology
*/
ArrayList<String> child = new ArrayList<String>();
child.add(ConstantVariables.profile_description_full);
childItem.add(child);
child = new ArrayList<String>();
child.add("Industry: "
+ ConstantVariables.profile_selectMultipleIndustry);
childItem.add(child);
child = new ArrayList<String>();
child.add(ConstantVariables.profile_cityName_full + ", "
+ ConstantVariables.profile_countryName_full + '\n'
+ ConstantVariables.profile_websiteAddress_full);
childItem.add(child);
}
这是我的代码供参考。
尝试在 XML 文件的 TextView
定义中包含以下内容:
<TextView
...
android:autoLink="web"/>
android:autoLink 的文档说:
Controls whether links such as urls and email addresses are automatically found and converted to clickable links
因此,对于自动查找链接,以上内容可能会有所帮助。试试看。
我正在尝试使文本的特定部分可以点击。例如,请看下图:
在这张图片中,"www.google.com" 被放置在一个可展开的列表视图中。 任何人都可以帮助我如何使此文本可点击以便它重定向到其相应的网页
ArrayList<String> groupItem = new ArrayList<String>();
ArrayList<Object> childItem = new ArrayList<Object>();
public void setGroupData() {
groupItem.add("About");
groupItem.add("General Information");
groupItem.add("Contact");
}
public void setChildGroupData() {
/**
* Add Data For TecthNology
*/
ArrayList<String> child = new ArrayList<String>();
child.add(ConstantVariables.profile_description_full);
childItem.add(child);
child = new ArrayList<String>();
child.add("Industry: "
+ ConstantVariables.profile_selectMultipleIndustry);
childItem.add(child);
child = new ArrayList<String>();
child.add(ConstantVariables.profile_cityName_full + ", "
+ ConstantVariables.profile_countryName_full + '\n'
+ ConstantVariables.profile_websiteAddress_full);
childItem.add(child);
}
这是我的代码供参考。
尝试在 XML 文件的 TextView
定义中包含以下内容:
<TextView
...
android:autoLink="web"/>
android:autoLink 的文档说:
Controls whether links such as urls and email addresses are automatically found and converted to clickable links
因此,对于自动查找链接,以上内容可能会有所帮助。试试看。