2016-04-05 20 views
0

我在片段的佈局中使用webview內部並在創建片段時使用本地.html文件加載。但我希望有一個可點擊的鏈接,點擊打開互聯網瀏覽器將您帶到網頁。如何才能做到這一點?Android .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">&nbsp;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> 

目前它的外觀 enter image description here

回答