TextView可下载文件链接中的Android HTML不工作
我在使用java代码的TextView可下载文件链接中的Android HTML不工作,android,html,textview,Android,Html,Textview,我在使用java代码的上看到了许多答案: TextView textView =(TextView)findViewById(R.id.textView); textView.setClickable(true); textView.setMovementMethod(LinkMovementMethod.getInstance()); String text = "<a href='example.com/test.json' download>
上看到了许多答案:
TextView textView =(TextView)findViewById(R.id.textView);
textView.setClickable(true);
textView.setMovementMethod(LinkMovementMethod.getInstance());
String text = "<a href='example.com/test.json' download> Download Now </a>";
textView.setText(Html.fromHtml(text));
// From API level >= 24 onwards Html.fromHtml(String source) is deprecated instead use fromHtml(String, int)
textView.setText(Html.fromHtml(text, Html.FROM_HTML_MODE_COMPACT));
url是json文件吗?是的,你可以检查我在互联网上找到的示例。你能详细地向我解释一下你想要实现什么吗?我想像这样下载该文件:那么,你是指打开的安装,你想下载它吗。?对的
android:autoLink="web"
android:linksClickable="true