This repository was archived by the owner on Mar 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
samples/BlurViewFormsSample/BlurViewFormsSample
BlurViewFormsSample.Android Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848 <Reference Include =" System.Xml" />
4949 </ItemGroup >
5050 <ItemGroup >
51+ <PackageReference Include =" Xamarin.BlurView" >
52+ <Version >1.3.4</Version >
53+ </PackageReference >
5154 <PackageReference Include =" Xamarin.Forms" Version =" 3.0.0.482510" />
5255 <PackageReference Include =" Xamarin.Android.Support.Design" Version =" 27.0.2" />
5356 <PackageReference Include =" Xamarin.Android.Support.v7.AppCompat" Version =" 27.0.2" />
Original file line number Diff line number Diff line change 1+ using Android . App ;
2+ using Android . Content ;
3+ using Android . Views ;
4+ using Android . Widget ;
5+
6+ using Xamarin . Forms ;
7+ using Xamarin . Forms . Platform . Android ;
8+
9+ using Com . EightbitLab . BlurViewBinding ;
10+
11+ using BlurViewFormsSample ;
12+ using BlurViewFormsSample . Droid ;
13+
14+ [ assembly: ExportRenderer ( typeof ( FormsBlurView ) , typeof ( FormsBlurViewRenderer ) ) ]
15+
16+ namespace BlurViewFormsSample . Droid
17+ {
18+ public class FormsBlurViewRenderer : ViewRenderer < FormsBlurView , FrameLayout >
19+ {
20+ public FormsBlurViewRenderer ( Context context ) : base ( context )
21+ {
22+ }
23+
24+ protected override void OnElementChanged ( ElementChangedEventArgs < FormsBlurView > e )
25+ {
26+ base . OnElementChanged ( e ) ;
27+
28+ if ( Control == null )
29+ {
30+ var context = Context ;
31+ var activity = context as Activity ;
32+
33+ var rootView = ( ViewGroup ) activity . Window . DecorView . FindViewById ( Android . Resource . Id . Content ) ;
34+ var windowBackground = activity . Window . DecorView . Background ;
35+
36+ var blurView = new BlurView ( context ) ;
37+
38+ blurView . SetOverlayColor ( Resource . Color . colorOverlay ) ;
39+
40+ blurView . SetupWith ( rootView )
41+ . WindowBackground ( windowBackground )
42+ . BlurAlgorithm ( new RenderScriptBlur ( context ) )
43+ . BlurRadius ( 10f ) ;
44+
45+ SetNativeControl ( blurView ) ;
46+ }
47+ }
48+ }
49+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+
6+ using Xamarin . Forms ;
7+
8+ namespace BlurViewFormsSample
9+ {
10+ public class FormsBlurView : StackLayout
11+ {
12+
13+ }
14+ }
Original file line number Diff line number Diff line change 44 xmlns : local =" clr-namespace:BlurViewFormsSample"
55 x : Class =" BlurViewFormsSample.MainPage" >
66
7+ <ScrollView >
8+ <StackLayout BackgroundColor =" Red" >
9+ <Label Text =" Welcome to Xamarin.Forms!" HorizontalOptions =" Center" VerticalOptions =" CenterAndExpand" />
10+
11+ <local : FormsBlurView HeightRequest =" 100" >
12+ <Label Text =" Test Text" />
13+ <Button Text =" Click me!" />
14+ </local : FormsBlurView >
15+
16+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
17+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
18+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
19+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
20+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
21+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
22+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
23+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
24+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
25+ <BoxView BackgroundColor =" Blue" HeightRequest =" 100" />
26+ </StackLayout >
27+ </ScrollView >
728
829</ContentPage >
You can’t perform that action at this time.
0 commit comments