我在内部使用webview查看片段的布局,并在创建片段时使用本地.html文件加载。但我希望有一个可点击的链接,点击打开互联网浏览器,带你到网页。如何才能做到这一点?
XML布局
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/first_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<WebView
android:id="@+id/setup_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
我的本地.html文件
<!DOCTYPE html>
<html>
<link>
<h1 style="background-color:#000044;color:white"> Setup</h1>
<p>There are two ways to set up the app to be able to connect to a robot. You can use a simulated robot, or a real robot.</p>
<hr>
<h3><font color="#000044">Using a Simulated Robot</font></h3>
<p>It is likely easier to access a simulated robot than a real one so follow these steps to set it up</p>
<h4><font color="#000044">Step 1: Installing Ubuntu 14.04.3</font></h4>
<p>Download a 32 or 64 bit Ubuntu 14.04.3 iso, either will work, and install it on a physical computer or a virtual machine.</p>
<p>The robot will move much much smoother if Ubuntu 14.04 is installed to a physical computer.</p>
<h4><font color="#000044">Step 2: Installing ROS Indigo</font> </h4>
<p>Once you have Ubuntu installed, follow the instructions at <link>http://wiki.ros.org/indigo/Installation/Ubuntu</link></p>
<br>