Clickable Link inside an Android .html raw file

Issue

I’m using a webview inside for a fragment’s layout and using a local .html file to load when the fragment is created. But I would like to have a clickable link that on click opens the internet browser to take you to the webpage. How can this be done?

XML layout

<?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>

My local .html file

<!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>

How it currently looks enter image description here

Solution

Just use a standard html link tag (<a href...>)

Answered By – F43nd1r

Leave a Comment