Is there a way to define a webview in the layout xml rather than in the code.
And if so how? Or is it recommended that it's coded in to an activity?
This interface was deprecated in API level 12. This interface is now obsolete.
The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.
Yes as above use the WebView tag:
<WebView android:id="@+id/webview"
android:layout_width="fill_parent" android:layout_height="50dip"/>
A sample application can be found here: http://www.androiddom.com/2011/04/creating-android-calculator-tutorial.html
The author creates a calculator that uses the WebView which is specified in the main.xml layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With