【问题标题】:Add a border to the web view为 Web 视图添加边框
【发布时间】:2018-09-25 18:10:09
【问题描述】:

我正在使用 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>

【问题讨论】:

    标签: xamarin xamarin.forms xamarin.android


    【解决方案1】:

    将您的 WebView 包裹在 Frame 周围。所以:

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

    如果你没有在它之间放置任何东西,你也不必写一个额外的结束标签。注意我是如何关闭那个 WebView 标记的。

    【讨论】:

    • 感谢您的解决方案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-20
    相关资源
    最近更新 更多