在网络视图中添加边框

时间:2018-09-25 09:27:44

标签: xamarin xamarin.forms xamarin.android

我正在使用Visual Studio 2017进行Xamarin Forms项目,我想在Web视图中添加边框。黑色。下面是如何查看xaml的视图。

 <StackLayout Orientation="Vertical"  BackgroundColor="White" HorizontalOptions="FillAndExpand">
        <StackLayout Orientation="Horizontal" HeightRequest="60" HorizontalOptions="FillAndExpand" BackgroundColor="DarkBlue" Padding="5">
            <Label x:Name="lblUserNewOnBoarding" WidthRequest="340" Text="New User Onboarding" FontAttributes="Bold"  FontFamily="Roboto" FontSize="Large" TextColor="White" 
                   HorizontalOptions="StartAndExpand" VerticalOptions="CenterAndExpand"></Label>
            <Button x:Name="bntCancel"  Text="Cancel"  HeightRequest="40" BackgroundColor="#4184f3"  
                    TextColor="White"    HorizontalOptions="EndAndExpand" VerticalOptions="CenterAndExpand"  Clicked="HandleCancle_Clicked"   FontFamily="Roboto" FontSize="Small" FontAttributes="Bold">
                <Button.Image>
                    <FileImageSource File="baseline_cancel_white_18dp.png" ></FileImageSource>
                </Button.Image>
            </Button>
        </StackLayout>
        <StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand"  >
            <Label Text="Please agree to the following terms and conditions…" FontFamily="Roboto-Medium" FontSize="30" 
                   HorizontalOptions="CenterAndExpand"  WidthRequest="927"  HeightRequest="168" Margin="5"  
                   TextColor="Black"></Label>

            <WebView x:Name="wvAgree"  HeightRequest="300"  WidthRequest="400" Margin="50" BackgroundColor="White" ></WebView>
            <Button x:Name="btnAgree"  Text="Agree"   WidthRequest="190"  HeightRequest="50"  AnchorX="417"  AnchorY="604"
                    BackgroundColor="#4184f3"   TextColor="White"    HorizontalOptions="Center" VerticalOptions="CenterAndExpand" Clicked="HandleAgree_Clicked"   FontFamily="Roboto" FontSize="Small" FontAttributes="Bold">
                <Button.Image >
                    <FileImageSource File="Agree.png"></FileImageSource>
                </Button.Image>
            </Button>
            <Button x:Name="btnDisAgree"  Text="Disagree"  WidthRequest="190"  HeightRequest="50"  AnchorX="417"  AnchorY="673" BackgroundColor="#4184f3"   
                    TextColor="White"    HorizontalOptions="Center" VerticalOptions="CenterAndExpand"  Clicked="HandleDisAgree_Clicked"   FontFamily="Roboto" FontSize="Small" FontAttributes="Bold">
                <Button.Image>
                    <FileImageSource File="baseline_delete_48.png" ></FileImageSource>
                </Button.Image>
            </Button>
        </StackLayout>
    </StackLayout>

1 个答案:

答案 0 :(得分:1)

将WebView环绕Frame。所以:

<Frame OutlineColor="Black">
<WebView x:Name="wvAgree"  HeightRequest="300"  WidthRequest="400" Margin="50" BackgroundColor="White"/>
</Frame>

如果您在中间没有插入任何结束标记,也不必编写其他标记。请注意我如何关闭该WebView标记。