Step1:
MainPage.Xaml
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:AwesomeWebView" x:Class="AwesomeWebView.MainPage" NavigationPage.HasNavigationBar="false"> <AbsoluteLayout> <StackLayout AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1"> <WebView x:Name="browser" VerticalOptions="FillAndExpand" Navigating="WebOnNavigating" Navigated="WebOnNavigated"/> </StackLayout> <Frame AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,AutoSize,AutoSize" x:Name="loading" BackgroundColor="Gray" Opacity="0.9" IsVisible="True"> <StackLayout> <ActivityIndicator IsRunning="True"/> <Label Text="Loading..." TextColor="White"/> </StackLayout> </Frame> </AbsoluteLayout> </ContentPage>
Step2: MainPage.Xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; namespace AwesomeWebView { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); browser.Source = "https://giphy.com/search/smiling"; } void WebOnNavigating(object sender, WebNavigatingEventArgs s) { loading.IsVisible = true; } void WebOnNavigated(object sender, WebNavigationEventArgs s) { loading.IsVisible = false; } } }
Step 3: Holaa!!!! No Steps Tutorial Completed :D
Thanks!!
ReplyDelete