使用这个字符串:
String stringConvertor="We are looking for talented individuals who share our values and <a href='http://www.precipeace.com/about/' target='_blank'>mission</a>. What is your motivation for joining our company?","quesNo":1,"__v":0,"isDelete":false,"createdAt":"2017-08-16T11:51:05.644Z"},{"_id":"599431be8eedf235d9965a08","question":"Currently, we utilize coaching techniques like CBT, positive psychology, and other solution focused techniques to help our clients. <br class='breakclass'/><br class='breakclass'/> Are you familiar and capable of utilizing these techniques or open to learning about them? What other techniques do you have experience with that you feel would benefit your future clients?"代码:
<TextView
android:id="@+id/txt_screening_question"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/text_size_medium"
android:textSize="@dimen/text_size_medium"
android:autoLink="web"
android:linksClickable="true"
android:text="We are looking for talented individuals who share our values and mission. What is your motivation for joining our company?"
android:textColor="@color/colorGrey"/>Java代码:
Linkify.addLinks(txtScreeningQuestion, Linkify.WEB_URLS);
txtScreeningQuestion.setText(Html.fromHtml(stringConvertor));给我提供解决方案如何点击它请给我任何解决方案如何点击锚标签串
发布于 2017-10-16 21:30:29
尝试以以下格式将字符串保存在strings.xml中。
<string name="welcome">
<![CDATA[ Welcome to <a href=\'http://www.google.com\'>Google</a>.]]>
</string>然后将字符串分配给您的TextView,如下所示:
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(getString(R.string.welcome)));
PackageManager manager = getPackageManager();
List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
if (infos.size() > 0) {
//At least one application can handle your intent
//Put this code in onCreate and only Linkify the TextView from here
//instead of using android:autoLink="web" in xml
Linkify.addLinks(txtScreeningQuestion, Linkify.ALL);
// or tvTextView.setAutoLinkMask(Linkify.WEB_URL),
}
txtScreeningQuestion.setText(Html.fromHtml(getString(R.string.welcome));https://stackoverflow.com/questions/46771356
复制相似问题