public override void OnViewCreated (View view, Bundle savedInstanceState) { var root = (FrameLayout)view; var context = view.Context; if (context == null) return; // This is how the fragment looks at first. Since the transition is one-way, we don't need to make // this a Scene. var item = LayoutInflater.From (context).Inflate (Resource.Layout.item_meat_grid, root, false); if (item == null) return; Bind (item); // We adjust the position of the initial image with LayoutParams using the values supplied // as the fragment arguments. Bundle args = Arguments; FrameLayout.LayoutParams param = null; if (args != null) { param = new FrameLayout.LayoutParams ( args.GetInt (ARG_WIDTH), args.GetInt (ARG_HEIGHT)); param.TopMargin = args.GetInt (ARG_Y); param.LeftMargin = args.GetInt (ARG_X); } root.AddView (item, param); }
public static TextView ConstructTitle(Context context, string Title, LinearLayout container = null, int Background = Resource.Drawable.bg_fragmentTitle, string TextColorCode = "#ffffff") { DisplayMetrics metrics = Resources.System.DisplayMetrics; var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); if (container == null) { var Parameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.Center); Parameters.BottomMargin = ((metrics.HeightPixels / 100) * 10) + ValueConverter.DpToPx(10); layoutParams = Parameters; } else { var Parameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams = Parameters; } TextView title = new TextView(context) { Text = Title, TextSize = TypedValue.ApplyDimension(ComplexUnitType.Dip, 8, metrics), TextAlignment = TextAlignment.Center, Alpha = 0, TranslationY = 50f }; int paddingLeftRight = ValueConverter.DpToPx(20); int paddingTopBottom = ValueConverter.DpToPx(10); title.SetPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom); title.SetBackgroundResource(Background); title.SetTextColor(Color.ParseColor(TextColorCode)); title.LayoutParameters = layoutParams; return(title); }
public void SurfaceCreated(ISurfaceHolder holder) { try { mCamera.SetPreviewDisplay(holder); } catch (Exception e) { Console.WriteLine(e.Message); } FrameLayout.LayoutParams lp = this.LayoutParameters as FrameLayout.LayoutParams; Display display = mContext.GetSystemService(Context.WindowService).JavaCast <IWindowManager>().DefaultDisplay; Android.Graphics.Point rect = new Android.Graphics.Point(); display.GetRealSize(rect); display.GetRealSize(rect); lp.Gravity = GravityFlags.CenterVertical; lp.Width = rect.X; // required width lp.Height = (int)(rect.X * (9 / 16f)); // required height this.LayoutParameters = lp; }
//This function should be async and should be called asyncronously private void DrawDamageCircle(VehicleMarkDamageDetails objVehicleMarkDamage) { try { TextView lblMarkDamageNumber = new TextView(this); lblMarkDamageNumber.Id = objVehicleMarkDamage.DamageNumber; lblMarkDamageNumber.Text = objVehicleMarkDamage.DamageNumber.ToString(); lblMarkDamageNumber.SetTextColor(Color.White); lblMarkDamageNumber.SetWidth(60); lblMarkDamageNumber.SetHeight(60); lblMarkDamageNumber.Gravity = GravityFlags.Center; if (rentRunningTrans.TransType.Equals("PRE")) { lblMarkDamageNumber.SetBackgroundResource(Resource.Drawable.rounded_corner_black); } else if (rentRunningTrans.TransType.Equals("OUT")) { lblMarkDamageNumber.SetTextColor(Color.White); if (objVehicleMarkDamage.ID > 0) { lblMarkDamageNumber.SetBackgroundResource(Resource.Drawable.rounded_corner_black); } else { lblMarkDamageNumber.SetBackgroundResource(Resource.Drawable.rounded_corner_green); } } else if (rentRunningTrans.TransType.Equals("IN")) { lblMarkDamageNumber.SetTextColor(Color.White); if (objVehicleMarkDamage.ID > 0) { lblMarkDamageNumber.SetBackgroundResource(Resource.Drawable.rounded_corner_black); } else { lblMarkDamageNumber.SetBackgroundResource(Resource.Drawable.rounded_corner_red); } } lblMarkDamageNumber.Click += MarkDamageNumber_Click; //lblMarkDamageNumber.SetOnTouchListener(this); lblMarkDamageNumber.SetOnLongClickListener(this); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WrapContent, FrameLayout.LayoutParams.WrapContent); layoutParams.TopMargin = objVehicleMarkDamage.DamageLocationY - 30; // margin in pixels, not dps layoutParams.LeftMargin = objVehicleMarkDamage.DamageLocationX - 30; // margin in pixels, not dps // add into my parent view _markdamage.AddView(lblMarkDamageNumber, layoutParams); } catch (Exception ex) { //Do nothing } }
private void setContentMode() { bool isImageMode = (null != mDrawable | null != mContentBitmap | 0 != mResId); bool isTextMode = (!TextUtils.IsEmpty(mContentText)); if (isImageMode && isTextMode) { FrameLayout.LayoutParams _params = (FrameLayout.LayoutParams)mContentTv.LayoutParameters; _params.Gravity = GravityFlags.Bottom; mContentTv.LayoutParameters = _params; mContentTv.SetBackgroundColor(Color.Black); mContentTv.Background.SetAlpha(0x28); mContentTv.Visibility = ViewStates.Visible; mContentIv.Visibility = ViewStates.Visible; return; } if (isTextMode) { FrameLayout.LayoutParams _params = (FrameLayout.LayoutParams)mContentTv.LayoutParameters; _params.Gravity = GravityFlags.Bottom; mContentTv.LayoutParameters = _params; mContentIv.Visibility = ViewStates.Gone; mContentTv.Visibility = ViewStates.Visible; return; } if (isImageMode) { mContentTv.Visibility = ViewStates.Gone; mContentIv.Visibility = ViewStates.Visible; return; } }
private AndroidBugfix5497(Activity activity) { FrameLayout content = (FrameLayout)activity.FindViewById(Android.Resource.Id.Content); mChildOfContent = content.GetChildAt(0); ViewTreeObserver vto = mChildOfContent.ViewTreeObserver; vto.GlobalLayout += (object sender, EventArgs e) => { possiblyResizeChildOfContent(); }; frameLayoutParams = (FrameLayout.LayoutParams)mChildOfContent.LayoutParameters; }
public BarcodeScanLayout(Context context, string holdStill, string alignBarcode) : base(context) { var param = new FrameLayout.LayoutParams(-1, -1, GravityFlags.Center); PreviewSurface = new SurfaceView(context); AddView(PreviewSurface, param); ViewFinderView = new ViewfinderView(context, holdStill, alignBarcode); AddView(ViewFinderView, param); LogoView = new ImageView(context); AddView(LogoView, param); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); FrameLayout frame = new FrameLayout(this); frame.SetId(R.Id.simple_fragment); SetContentView(frame, lp); if (savedInstanceState == null) { // Do first time initialization -- Add fragment. Fragment newFragment = new ReceiveResultFragment(); FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction(); ft.Add(R.Id.simple_fragment, newFragment).Commit(); } }
public override View GetSampleContent (Context con) { int height = con.Resources.DisplayMetrics.HeightPixels/2; LinearLayout linearLayout = new LinearLayout(con); linearLayout.SetGravity (Android.Views.GravityFlags.CenterHorizontal); linearLayout.Orientation = Android.Widget.Orientation.Vertical; linearLayout.SetBackgroundColor(Color.White); img = new ImageView(con); img.SetImageResource (Resource.Drawable.mount); linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linearLayout.SetPadding(20, 20, 20, 20); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height+(height/3.5)),GravityFlags.Center); img.SetPadding(12, 0, 10, 0); img.LayoutParameters = (layoutParams); range=new SfRangeSlider(con); range.Minimum = 0;range.Maximum = 100; range.Value = 100; range.ShowRange = false; range.SnapsTo = SnapsTo.None; range.Orientation = Com.Syncfusion.Sfrangeslider.Orientation.Horizontal; range.TickPlacement = TickPlacement.BottomRight; range.ShowValueLabel = true; range.TickFrequency = 20; range.ValuePlacement = ValuePlacement.BottomRight; range.LayoutParameters = (new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150)); range.ValueChanged += ValueChanged ; linearLayout.AddView(img); TextView text1 = new TextView(con); text1.Text = " Opacity"; text1.TextSize=20; text1.Gravity = GravityFlags.Left; range.SetY(-30); linearLayout.AddView(text1); linearLayout.AddView(range); FrameLayout frame = new FrameLayout(con); frame.SetBackgroundColor (Color.White); frame.LayoutParameters = ( new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent,GravityFlags.Center)); frame.AddView(linearLayout); return frame; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); var lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.MatchParent); var frame = new FrameLayout(this); frame.Id = Resource.Id.simple_fragment; SetContentView(frame, lp); if (savedInstanceState == null) { // Do first time initialization -- add fragment. var newFragment = new ReceiveResultFragment(); var ft = SupportFragmentManager.BeginTransaction(); ft.Add(Resource.Id.simple_fragment, newFragment).Commit(); } // Create your application here }
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) { int count = ChildCount; int maxHeight = 0; int maxWidth = 0; for (int i = 0; i < count; i++) { View child = GetChildAt(i); if (child.Visibility != ViewStates.Gone) { MeasureChild(child, widthMeasureSpec, heightMeasureSpec); maxHeight += child.MeasuredHeight; } } maxWidth += PaddingLeft + PaddingRight; maxHeight += PaddingTop + PaddingBottom; LayoutParameters = new FrameLayout.LayoutParams((int)(_width / 3.2), FrameLayout.LayoutParams.WrapContent); SetMeasuredDimension(ResolveSize((int)(_width / 3.2), widthMeasureSpec), ResolveSize(maxHeight, heightMeasureSpec)); }
/** * 创建基本的背景视图 */ private View CreateView() { FrameLayout parent = new FrameLayout(_mContext); FrameLayout.LayoutParams parentParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) { Gravity = GravityFlags.Bottom }; parent.LayoutParameters = parentParams; _mBg = new View(_mContext) { LayoutParameters = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) }; _mBg.SetBackgroundColor(Color.Argb(136, 0, 0, 0)); _mBg.Id = BgViewId; _mBg.SetOnClickListener(this); _mPanel = new LinearLayout(_mContext); FrameLayout.LayoutParams mPanelParams = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) { Gravity = GravityFlags.Bottom }; _mPanel.LayoutParameters = mPanelParams; //mPanel.setOrientation(LinearLayout.VERTICAL); //mPanel.Orientation = Linear parent.AddView(_mBg); parent.AddView(_mPanel); return parent; }
private void setupNavBarView(Context context, ViewGroup decorViewGroup) { mNavBarTintView = new View(context); FrameLayout.LayoutParams lparams; if (mConfig.isNavigationAtBottom()) { lparams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, mConfig.getNavigationBarHeight()); lparams.Gravity = GravityFlags.Bottom; } else { lparams = new FrameLayout.LayoutParams(mConfig.getNavigationBarWidth(), FrameLayout.LayoutParams.MatchParent); lparams.Gravity = GravityFlags.Right; } mNavBarTintView.LayoutParameters = lparams; mNavBarTintView.SetBackgroundColor(DEFAULT_TINT_COLOR); mNavBarTintView.Visibility = ViewStates.Gone; decorViewGroup.AddView(mNavBarTintView); }
public override View GetSampleContent (Context con) { LinearLayout mainLayout,layout1,layout2,layout3;; int height = con.Resources.DisplayMetrics.HeightPixels/2; int width = con.Resources.DisplayMetrics.WidthPixels/3; /** * Defining Linear Layout */ mainLayout = new LinearLayout(con); mainLayout.SetBackgroundColor(Color.White); mainLayout.SetGravity(GravityFlags.Center); LinearLayout parentLayout=new LinearLayout(con); parentLayout.Orientation=droid.Vertical; parentLayout.SetBackgroundColor(Color.White); parentLayout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); FrameLayout.LayoutParams sliderLayout = new FrameLayout.LayoutParams(width,height+(height/4)); textView = new TextView(con); textView7 = new TextView(con); textView8 = new TextView(con); textView9 = new TextView(con); textView9.Text=""; textView.Typeface= Typeface.Create("Roboto", TypefaceStyle.Normal); textView9.TextSize=20; textView9.Gravity=GravityFlags.Center; textView9.SetTextColor (Color.Argb(255,182,182,182)); //parentLayout.AddView(textView9); textView10 = new TextView(con); parentLayout.AddView(textView10); parentLayout.AddView(mainLayout); parentLayout.SetGravity(GravityFlags.Center); /** * Defining First Slider */ slider1 = new SfRangeSlider(con); slider1.Minimum=-12; slider1.Maximum=12; slider1.TickFrequency=12; slider1.TrackSelectionColor=Color.Gray; slider1.Orientation=Com.Syncfusion.Sfrangeslider.Orientation.Vertical; slider1.TickPlacement=TickPlacement.None; slider1.ValuePlacement=ValuePlacement.TopLeft; slider1.ShowValueLabel=true; slider1.SnapsTo=SnapsTo.None; slider1.Value=6; // slider1.setLayoutParams(sliderLayout); slider1.ValueChanged += (object sender, SfRangeSlider.ValueChangedEventArgs e) => { String str=(string)(Math.Round(e.P1)+".0db"); textView4.Text=str; }; layout1 = new LinearLayout(con); layout1.Orientation=droid.Vertical; layout1.SetGravity(GravityFlags.Center); textView1=new TextView(con); textView1.Text="60HZ"; textView1.TextSize=20; textView1.SetTextColor(Color.Black); textView1.Gravity=GravityFlags.Center; textView1.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal); textView4 = new TextView(con); textView4.TextSize=14; textView4.SetTextColor(Color.Argb(255, 50, 180, 228)); textView4.Text="0.0db"; textView4.Typeface=Typeface.Create("Helvetica", TypefaceStyle.Normal); textView4.Gravity=GravityFlags.Center; layout1.AddView(textView1); layout1.AddView(textView4); layout1.AddView(textView); layout1.AddView(slider1,sliderLayout); /** * Defining Second Slider */ slider2 = new SfRangeSlider(con); slider2.Minimum=-12; slider2.Maximum=12; slider2.TickFrequency=12; slider2.TrackSelectionColor=Color.Gray; slider2.Orientation=Com.Syncfusion.Sfrangeslider.Orientation.Vertical; slider2.TickPlacement=TickPlacement.None; slider2.ValuePlacement=ValuePlacement.TopLeft; slider2.ShowValueLabel=true; slider2.SnapsTo=SnapsTo.None; slider2.Value=-3; slider2.LayoutParameters=sliderLayout; slider2.ValueChanged+= (object sender, SfRangeSlider.ValueChangedEventArgs e) => { textView5.Text=Convert.ToString(Math.Round(e.P1)+".0db"); }; layout2 = new LinearLayout(con); layout2.Orientation=droid.Vertical; layout2.SetGravity(GravityFlags.Center); textView2=new TextView(con); textView2.Text="170HZ"; textView2.TextSize=20; textView2.SetTextColor(Color.Black); textView2.Gravity=GravityFlags.Center; textView2.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal); textView5 = new TextView(con); textView5.TextSize=14; textView5.SetTextColor(Color.Argb(255, 50, 180, 228)); textView5.Text="0.0db"; textView5.Typeface=Typeface.Create("Helvetica", TypefaceStyle.Normal); textView5.Gravity=GravityFlags.Center; layout2.AddView(textView2); layout2.AddView(textView5); layout2.AddView(textView7); layout2.AddView(slider2,sliderLayout); /** * Defining Third Slider */ slider3 = new SfRangeSlider(con); slider3.Minimum=-12; slider3.Maximum=12; slider3.TickFrequency=12; slider3.TrackSelectionColor=Color.Gray; slider3.Orientation=Com.Syncfusion.Sfrangeslider.Orientation.Vertical; slider3.TickPlacement=TickPlacement.None; slider3.ValuePlacement=ValuePlacement.TopLeft; slider3.ShowValueLabel=true; slider3.SnapsTo=SnapsTo.None; slider3.Value=12; slider3.LayoutParameters=sliderLayout; slider3.ValueChanged+= (object sender, SfRangeSlider.ValueChangedEventArgs e) => { textView6.Text=Convert.ToString(Math.Round(e.P1)+".0db"); }; layout3 = new LinearLayout(con); layout3.Orientation=droid.Vertical; layout3.SetGravity(GravityFlags.Center); textView3=new TextView(con); textView3.Text="310HZ"; textView3.TextSize=20; textView3.SetTextColor(Color.Black); textView3.Gravity=GravityFlags.Center; textView3.Typeface = Typeface.Create("Helvetica", TypefaceStyle.Normal); textView6 = new TextView(con); textView6.TextSize=14; textView6.SetTextColor(Color.Argb(255, 50, 180, 228)); textView6.Text="0.0db"; textView6.Typeface=Typeface.Create("Helvetica", TypefaceStyle.Normal); textView6.Gravity=GravityFlags.Center; layout3.AddView(textView3); layout3.AddView(textView6); layout3.AddView(textView8); layout3.AddView(slider3,sliderLayout); /** * Adding sliders to Layout */ mainLayout.AddView(layout1); mainLayout.AddView(layout2); mainLayout.AddView(layout3); return parentLayout; }
private View CreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout parent = new FrameLayout(Activity); parent.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mBg = new View(Activity); mBg.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mBg.SetBackgroundColor(Color.Argb(160, 0, 0, 0)); mBg.SetOnClickListener(this); mPanel = new LinearLayout(Activity); FrameLayout.LayoutParams param = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.WrapContent); param.Gravity = GravityFlags.Bottom; mPanel.LayoutParameters = param; mPanel.Orientation = Android.Widget.Orientation.Vertical; View child = OnCreateChildView(inflater, container, savedInstanceState); parent.AddView(mBg); parent.AddView(mPanel); mPanel.AddView(child); return parent; }
/// <summary> /// Returns the mapmarkers list. /// </summary> /// <value>The markers.</value> public void AddMarker(MapMarker marker) { if (marker == null) { throw new ArgumentNullException("marker"); }; _markers.Add (marker); // add to marker list. marker.AttachTo (this); // attach to this view. var layoutParams = new FrameLayout.LayoutParams (marker.Image.Width, marker.Image.Height + 5); layoutParams.LeftMargin = -1; layoutParams.TopMargin = -1; layoutParams.Gravity = GravityFlags.Top | GravityFlags.Left; this.AddView (marker, layoutParams); _mapView.Change (); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); OS.AutoDisposedGL = false; // Screen orientation var requiredOrientation = (desc.Orientation == ApplicationOrientations.Landscape) ? Android.Content.PM.ScreenOrientation.Landscape : Android.Content.PM.ScreenOrientation.Portrait; RequestedOrientation = requiredOrientation; // Remove title bar RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); // Create gl view VolumeControlStream = Android.Media.Stream.Music; view = new GLView(this); SetContentView(view); // Ads if (desc.UseAds) { adMobView = AdMobWrapper.CreateAdView(this, desc.PublisherID); var layout = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WrapContent, FrameLayout.LayoutParams.WrapContent, GravityFlags.Bottom); AddContentView(adMobView, layout); AdMobWrapper.LoadAd(adMobView, false); adMobView.Visibility = Android.Views.ViewStates.Visible; adMobView.BringToFront(); } // keep screen from locking var power = (PowerManager)GetSystemService(Context.PowerService); wakeLock = power.NewWakeLock(WakeLockFlags.ScreenDim, "AndroidApplication"); }
public override View GetSampleContent (Context context) { btn = new Button(context); btn.SetBackgroundResource(Resource.Drawable.burgericon); FrameLayout.LayoutParams btlayoutParams = new FrameLayout.LayoutParams(42,32, GravityFlags.Center); btn.LayoutParameters = btlayoutParams; btn.SetPadding (10,0,0,0); btn.Gravity=GravityFlags.CenterVertical; TextView textView = new TextView(context); textView.TextSize=20; textView.Text="Home"; textView.SetTextColor (Color.White); textView.Gravity=GravityFlags.Center; LinearLayout linearLayout = new LinearLayout(context); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 70, GravityFlags.Center); layoutParams.SetMargins (10,0,0,0); linearLayout.SetPadding (10,0,0,0); linearLayout.AddView(btn);linearLayout.AddView(textView,layoutParams); linearLayout.SetBackgroundColor(Color.Rgb(47,173,227)); height = context.Resources.DisplayMetrics.HeightPixels-75; width =context.Resources.DisplayMetrics.WidthPixels; LinearLayout linear2 = new LinearLayout(context); linear2.Orientation=Orientation.Vertical; linear2.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); FrameLayout.LayoutParams layout2= new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); linear2.AddView(linearLayout,layout2); /** * Main Content * */ FrameLayout gridLayout = new FrameLayout(context); gridLayout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); /** * item1 */ FrameLayout grid1 = new FrameLayout(context); ImageView img1 = new ImageView(context); img1.SetScaleType (ImageView.ScaleType.FitXy); img1.SetImageResource(Resource.Drawable.profile); FrameLayout.LayoutParams layoutParams1 = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center); grid1.AddView(img1, layoutParams1); grid1.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3); /** * item2 */ FrameLayout grid2 = new FrameLayout(context); ImageView img2 = new ImageView(context); img2.SetImageResource(Resource.Drawable.inbox); img2.SetScaleType (ImageView.ScaleType.FitXy); grid2.AddView(img2, layoutParams1); grid2.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3); /** * item3 */ FrameLayout grid3 = new FrameLayout(context); ImageView img3 = new ImageView(context); img3.SetImageResource(Resource.Drawable.outbox); img3.SetScaleType (ImageView.ScaleType.FitXy); grid3.AddView(img3, layoutParams1); grid3.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3); /** * item4 */ FrameLayout grid4 = new FrameLayout(context); ImageView img4 = new ImageView(context); img4.SetImageResource(Resource.Drawable.flag); img4.SetScaleType (ImageView.ScaleType.FitXy); grid4.AddView(img4, layoutParams1); grid4.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 100)/3); /** * item5 */ FrameLayout grid5 = new FrameLayout(context); ImageView img5 = new ImageView(context); img5.SetImageResource(Resource.Drawable.trash); img5.SetScaleType (ImageView.ScaleType.FitXy); grid5.AddView(img5, layoutParams1); grid5.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 155)/3); /** * item6 */ FrameLayout grid6 = new FrameLayout(context); ImageView img6 = new ImageView(context); img6.SetImageResource(Resource.Drawable.power); grid6.AddView(img6, layoutParams1); img6.SetScaleType (ImageView.ScaleType.FitXy); grid6.LayoutParameters=new ViewGroup.LayoutParams((width-20) / 2,(height - 155)/3); img1.SetPadding (0,0,0,3); img2.SetPadding (-1,0,0,3); img3.SetPadding (0,0,0,0); img4.SetPadding (-1,0,0,0); img5.SetPadding (0,0,0,15); img6.SetPadding (-1,0,0,15); int x=0; int y=5; int x1,y1; x1= (x)+(width/2); y1 = (2*y)+((height-100)/3); grid1.SetX(x); grid1.SetY(y); grid2.SetX(x1); grid2.SetY(y); grid3.SetX(x); grid3.SetY(y1); grid4.SetX(x1); grid4.SetY(y1); grid5.SetX(x); grid5.SetY((2*y1)); grid6.SetX(x1); grid6.SetY((2*y1)); gridLayout.AddView(grid1); gridLayout.AddView(grid2); gridLayout.AddView(grid3); gridLayout.AddView(grid4); gridLayout.AddView(grid5); gridLayout.AddView(grid6); FrameLayout ContentFrame = new FrameLayout (context); ContentFrame.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, height-75); ContentFrame.SetBackgroundColor (Color.White); ContentFrame.AddView (gridLayout); gridLayout.SetBackgroundColor (Color.White); linear2.AddView (ContentFrame); LinearLayout contentLayout= new LinearLayout(context); RoundedImageView imgvw=new RoundedImageView(context,120,120); imgvw.SetPadding(0,10,0,10); imgvw.SetImageResource(Resource.Drawable.user); LinearLayout.LayoutParams layparams8 = new LinearLayout.LayoutParams(120, 120); layparams8.Gravity = GravityFlags.Center; imgvw.LayoutParameters=new ViewGroup.LayoutParams(120, 120); TextView text = new TextView(context); text.Text="James Pollock"; text.Gravity=GravityFlags.Center; text.TextSize=17; text.SetTextColor(Color.White); text.SetPadding (0,20,0,0); text.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); LinearLayout headerLayout=new LinearLayout(context); headerLayout.Orientation=Orientation.Vertical; headerLayout.SetBackgroundColor(Color.Rgb(47,173,227)); headerLayout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200); headerLayout.SetGravity (GravityFlags.Center); headerLayout.AddView(imgvw,layparams8); headerLayout.AddView(text); LinearLayout.LayoutParams layparams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int) (height * 0.15)); layparams2.Gravity = GravityFlags.Center; contentLayout.AddView(headerLayout); LinearLayout.LayoutParams layparams5 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (2)); contentLayout.AddView(new SeparatorView(context,width){separatorColor=Color.LightGray},layparams5); contentLayout.SetBackgroundColor (Color.White); linear2.SetBackgroundColor(Color.White); slideDrawer = new Com.Syncfusion.Navigationdrawer.SfNavigationDrawer(context); slideDrawer.ContentView=linear2; slideDrawer.DrawerWidth = (float)(width * 0.60); slideDrawer.DrawerHeight = (float)(height * 0.60); slideDrawer.Transition=Transition.SlideOnTop; slideDrawer.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); listView = new ListView(context); listView.VerticalScrollBarEnabled = true; btn.Click+= (object sender, EventArgs e) => { slideDrawer.ToggleDrawer(); }; List<String> list = new List<String>(); list.Add("Home"); list.Add("Profile"); list.Add("Inbox"); list.Add("Outbox"); list.Add("Sent Items"); list.Add("Trash"); ArrayAdapter<String> arrayAdapter =new ArrayAdapter<String>(context, Android.Resource.Layout.SimpleListItem1,list); listView.SetAdapter(arrayAdapter); listView.SetBackgroundColor(Color.White); listView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.MatchParent); contentLayout.AddView(listView); contentLayout.Orientation=Orientation.Vertical; FrameLayout frame = new FrameLayout (context); frame.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); frame.SetBackgroundColor (Color.White); frame.AddView (contentLayout); slideDrawer.DrawerContentView=frame; /** * profile content * */ LinearLayout profilelayout = new LinearLayout(context); profilelayout.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); profilelayout.Orientation = Orientation.Vertical; LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.SetGravity(GravityFlags.Center); linearLayout2.SetPadding(0,30,0,30); linearLayout2.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); RoundedImageView rddimgvw=new RoundedImageView(context, 150, 150); rddimgvw.LayoutParameters=new ViewGroup.LayoutParams( 150, 150); rddimgvw.SetImageResource(Resource.Drawable.user); LinearLayout txtlayout=new LinearLayout(context); txtlayout.SetPadding(40,0,0,0); txtlayout.Orientation=Orientation.Vertical; TextView txtvw=new TextView(context); txtvw.TextSize=20; txtvw.Text="JamesPollock"; txtvw.SetTextColor (Color.Black); TextView txtvw1=new TextView(context); txtvw1.Text="Age 30"; txtvw1.TextSize=13; txtvw1.SetTextColor (Color.Black); txtlayout.AddView(txtvw); txtlayout.AddView(txtvw1); linearLayout2.AddView(rddimgvw); linearLayout2.AddView(txtlayout); linearLayout2.SetBackgroundColor(Color.White); profilelayout.AddView(linearLayout2); //int Width=context.getResources().getDisplayMetrics().widthPixels; profilelayout.Orientation=Orientation.Vertical; FrameLayout.LayoutParams separatorparams=new FrameLayout.LayoutParams(width,2,GravityFlags.Center); SeparatorView separatorView = new SeparatorView(context,width); separatorView.separatorColor = Color.LightGray; //separatorView.Invalidate (); separatorView.SetPadding(20,0,20,20); profilelayout.AddView(separatorView, separatorparams); TextView textView60 = new TextView(context); textView60.TextSize=16; textView60.SetPadding(20,0,20,0); textView60.SetBackgroundColor(Color.White); textView60.Text="\n" + "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.\n" + "\n" + "\n" + "when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.\n" + "\n" + "\n" + "James Pollock"; //textView.setHorizontallyScrolling(false); profilelayout.AddView(textView60); profilelayout.SetBackgroundColor (Color.White); /** * InBox Layout */ LinearLayout inboxLayout=new LinearLayout(context); inboxLayout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); inboxLayout.SetBackgroundColor (Color.White); inboxLayout.Orientation=Orientation.Vertical; LinearLayout mail1=new LinearLayout(context); TextView textView8 = new TextView(context); textView8.Text="John"; textView8.TextSize=18; TextView textView9 = new TextView(context); textView9.Text="Update on Timeline"; textView9.SetTextColor(Color.ParseColor("#1CAEE4")); textView9.TextSize=16; TextView textView10 = new TextView(context); textView10.Text="Hi John, See you at 10AM"; SeparatorView separate4 = new SeparatorView(context, width * 2); separate4.separatorColor = Color.LightGray; separate4.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 3); LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(width * 2, 3); layoutParams5.SetMargins(0, 10, 15, 0); textView10.TextSize=13; mail1.AddView(textView8); mail1.AddView(textView10); LinearLayout mail2=new LinearLayout(context); TextView textView11 = new TextView(context); textView11.Text="Caster"; textView11.TextSize=18; TextView textView12 = new TextView(context); textView12.Text="Update on Timeline"; textView12.SetTextColor(Color.ParseColor("#1CAEE4")); textView12.TextSize=16; TextView textView13 = new TextView(context); textView13.Text="Hi Caster, See you at 11AM"; //textView13.setTextColor(Color.parseColor("#1CAEE4")); textView13.TextSize=13; mail2.AddView(textView11); //mail2.addView(textView12); mail2.AddView(textView13); SeparatorView separate1 = new SeparatorView(context, width * 2); separate1.separatorColor = Color.LightGray; separate1.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); LinearLayout mail3=new LinearLayout(context); TextView textView14 = new TextView(context); textView14.Text="Joey"; textView14.TextSize=18; TextView textView15 = new TextView(context); textView15.Text="Update on Timeline"; textView15.SetTextColor(Color.ParseColor("#1CAEE4")); textView15.TextSize=16; TextView textView16 = new TextView(context); textView16.Text="Hi Joey, See you at 1PM"; textView16.TextSize=13; mail3.AddView(textView14); mail3.AddView(textView16); SeparatorView separate5 = new SeparatorView(context, width * 2); separate5.separatorColor = Color.LightGray; separate5.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); LinearLayout mail4=new LinearLayout(context); TextView textView17 = new TextView(context); textView17.Text="Xavier"; textView17.TextSize=18; TextView textView18 = new TextView(context); textView18.Text="Update on Timeline"; textView18.SetTextColor(Color.ParseColor("#1CAEE4")); textView18.TextSize=16; TextView textView19 = new TextView(context); textView19.Text="Hi Xavier, See you at 2PM"; textView19.TextSize=13; mail4.AddView(textView17); mail4.AddView(textView19); SeparatorView separate3 = new SeparatorView(context, width * 2); separate3.separatorColor = Color.LightGray; separate3.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); LinearLayout mail9=new LinearLayout(context); TextView textView33 = new TextView(context); textView33.Text="Gonzalez"; textView33.TextSize=18; TextView textView34 = new TextView(context); textView34.Text="Update on Timeline"; textView34.SetTextColor(Color.ParseColor("#1CAEE4")); textView34.TextSize=16; TextView textView35 = new TextView(context); textView35.Text="Hi Gonzalez, See you at 3PM"; textView35.TextSize=13; mail9.AddView(textView33); //mail4.addView(textView18); mail9.AddView(textView35); SeparatorView separate7 = new SeparatorView(context, width * 2); separate7.separatorColor = Color.LightGray; separate7.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); LinearLayout mail10=new LinearLayout(context); TextView textView36 = new TextView(context); textView36.Text="Rodriguez"; textView36.TextSize=18; TextView textView37 = new TextView(context); textView37.Text="Update on Timeline"; textView37.SetTextColor(Color.ParseColor("#1CAEE4")); textView37.TextSize=16; TextView textView38 = new TextView(context); textView38.Text="Hi Rodriguez, See you at 4PM"; textView38.TextSize=13; mail10.AddView(textView36); mail10.AddView(textView38); SeparatorView separate10 = new SeparatorView(context, width * 2); separate10.separatorColor = Color.LightGray; separate10.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); LinearLayout mail11=new LinearLayout(context); TextView textView39 = new TextView(context); textView39.Text="Ruben"; textView39.TextSize=18; TextView textView40 = new TextView(context); textView40.Text="Update on Timeline"; textView40.SetTextColor(Color.ParseColor("#1CAEE4")); textView40.TextSize=16; TextView textView41 = new TextView(context); textView41.Text="Hi Ruben, See you at 6PM"; textView41.TextSize=13; mail11.AddView(textView39); mail11.AddView(textView41); SeparatorView separate11 = new SeparatorView(context, width * 2); separate11.separatorColor = Color.LightGray; separate11.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail1.Orientation=Orientation.Vertical; mail2.Orientation=Orientation.Vertical; mail3.Orientation=Orientation.Vertical; mail4.Orientation=Orientation.Vertical; mail9.Orientation=Orientation.Vertical; mail10.Orientation=Orientation.Vertical; mail11.Orientation=Orientation.Vertical; mail1.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail1.SetPadding(20,10,10,5); mail2.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail2.SetPadding(20,10,10,5); mail3.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail3.SetPadding(20,10,10,5); mail4.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail4.SetPadding(20,10,10,5); mail9.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail9.SetPadding(20,10,10,5); mail10.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail10.SetPadding(20,10,10,5); mail11.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail11.SetPadding(20,10,10,5); inboxLayout.SetPadding(20,0,20,20); inboxLayout.AddView(mail1); inboxLayout.AddView(separate4,layoutParams5); inboxLayout.AddView(mail2); inboxLayout.AddView(separate1,layoutParams5); inboxLayout.AddView(mail3); inboxLayout.AddView(separate5,layoutParams5); inboxLayout.AddView(mail4); inboxLayout.AddView(separate3,layoutParams5); inboxLayout.AddView(mail9); inboxLayout.AddView(separate7,layoutParams5); inboxLayout.AddView(mail10); inboxLayout.AddView(separate11,layoutParams5); inboxLayout.AddView(mail11); inboxLayout.AddView(separate10,layoutParams5); img2.Click+= (object sender, EventArgs e) => { ContentFrame.RemoveAllViews(); inboxLayout.RemoveAllViews(); inboxLayout.SetPadding(20,0,20,20); inboxLayout.AddView(mail1); inboxLayout.AddView(separate4,layoutParams5); inboxLayout.AddView(mail2); inboxLayout.AddView(separate1,layoutParams5); inboxLayout.AddView(mail3); inboxLayout.AddView(separate5,layoutParams5); inboxLayout.AddView(mail4); inboxLayout.AddView(separate3,layoutParams5); inboxLayout.AddView(mail9); inboxLayout.AddView(separate7,layoutParams5); inboxLayout.AddView(mail10); inboxLayout.AddView(separate11,layoutParams5); inboxLayout.AddView(mail11); inboxLayout.AddView(separate10,layoutParams5); ContentFrame.AddView(inboxLayout); textView.Text="Inbox"; }; /** * Outbox content */ LinearLayout outboxlayout=new LinearLayout(context); outboxlayout.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); outboxlayout.SetBackgroundColor(Color.White); outboxlayout.Orientation=(Orientation.Vertical); LinearLayout mail5=new LinearLayout(context); TextView textView20 = new TextView(context); textView20.Text="Ruben"; textView20.TextSize=20; TextView textView21 = new TextView(context); textView21.Text="Update on Timeline"; textView21.SetTextColor(Color.ParseColor("#1CAEE4")); textView21.TextSize=16; TextView textView22 = new TextView(context); textView22.Text="Hi Ruben, see you at 6PM"; SeparatorView separate6 = new SeparatorView(context, width * 2); separate6.separatorColor = Color.LightGray; separate6.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); textView22.TextSize=13; mail5.AddView(textView20); mail5.AddView(textView22); LinearLayout mail6=new LinearLayout(context); TextView textView23 = new TextView(context); textView23.Text="Rodriguez"; textView23.TextSize=20; TextView textView24 = new TextView(context); textView24.Text="Update on Timeline"; textView24.SetTextColor(Color.ParseColor("#1CAEE4")); textView24.TextSize=16; TextView textView25 = new TextView(context); textView25.Text="Hi Rodriguez, see you at 4PM"; textView25.TextSize=13; mail6.AddView(textView23); mail6.AddView(textView25); LinearLayout mail12=new LinearLayout(context); TextView textView42 = new TextView(context); textView42.Text="Gonzalez"; textView42.TextSize=20; TextView textView43 = new TextView(context); textView43.Text="Update on Timeline"; textView43.SetTextColor(Color.ParseColor("#1CAEE4")); textView43.TextSize=16; TextView textView44 = new TextView(context); textView44.Text="Hi Gonzalez, see you at 3PM"; mail12.AddView(textView42); //mail12.addView(textView43); mail12.AddView(textView44); SeparatorView separate14 = new SeparatorView(context, width * 2); separate14.separatorColor = Color.LightGray; separate14.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail12.Orientation=Orientation.Vertical; mail12.Orientation=(Orientation.Vertical); mail5.Orientation=Orientation.Vertical; mail6.Orientation=Orientation.Vertical; LinearLayout mail13=new LinearLayout(context); TextView textView45 = new TextView(context); textView45.Text="Xavier"; textView45.TextSize=20; TextView textView46 = new TextView(context); textView46.Text="Update on Timeline"; textView46.SetTextColor(Color.ParseColor("#1CAEE4")); textView46.TextSize=16; TextView textView47 = new TextView(context); textView47.Text="Hi Xavier, see you at 2PM"; SeparatorView separate15 = new SeparatorView(context, width * 2); separate15.separatorColor = Color.LightGray; separate15.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail13.AddView(textView45); mail13.AddView(textView47); mail13.Orientation=(Orientation.Vertical); mail13.Orientation=(Orientation.Vertical); LinearLayout mail14=new LinearLayout(context); TextView textView48 = new TextView(context); textView48.Text="Joey"; textView48.TextSize=20; TextView textView49 = new TextView(context); textView49.Text="Update on Timeline"; textView49.SetTextColor(Color.ParseColor("#1CAEE4")); textView49.TextSize=16; TextView textView50 = new TextView(context); textView50.Text="Hi Joey, see you at 1PM"; SeparatorView separate16 = new SeparatorView(context, width * 2); separate16.separatorColor = Color.LightGray; separate16.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail14.AddView(textView48); //mail12.addView(textView43); mail14.AddView(textView50); mail14.Orientation=(Orientation.Vertical); mail14.Orientation=(Orientation.Vertical); LinearLayout mail15=new LinearLayout(context); TextView textView51 = new TextView(context); textView51.Text="Joey"; textView51.TextSize=20; TextView textView52 = new TextView(context); textView52.Text="Update on Timeline"; textView52.SetTextColor(Color.ParseColor("#1CAEE4")); textView52.TextSize=16; TextView textView53 = new TextView(context); textView53.Text="Hi Joey, see you at 1PM"; SeparatorView separate17 = new SeparatorView(context, width * 2); separate17.separatorColor = Color.LightGray; separate17.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail15.AddView(textView51); mail15.AddView(textView53); mail15.Orientation=(Orientation.Vertical); mail15.Orientation=(Orientation.Vertical); LinearLayout mail16=new LinearLayout(context); TextView textView54 = new TextView(context); textView54.Text=("Caster"); textView54.TextSize=(20); TextView textView55 = new TextView(context); textView55.Text=("Update on Timeline"); textView55.SetTextColor(Color.ParseColor("#1CAEE4")); textView55.TextSize=(16); TextView textView56 = new TextView(context); textView56.Text=("Hi Caster, see you at 11PM"); SeparatorView separate18 = new SeparatorView(context, width * 2); separate18.separatorColor = Color.LightGray; separate18.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail16.AddView(textView54); mail16.AddView(textView56); mail16.Orientation=(Orientation.Vertical); mail16.Orientation=(Orientation.Vertical); LinearLayout mail17=new LinearLayout(context); TextView textView57 = new TextView(context); textView57.Text="john"; textView57.TextSize=20; TextView textView58 = new TextView(context); textView58.Text=("Update on Timeline"); textView58.SetTextColor(Color.ParseColor("#1CAEE4")); textView58.TextSize=(16); TextView textView59 = new TextView(context); textView59.Text=("Hi John, see you at 10AM"); SeparatorView separate19 = new SeparatorView(context, width * 2); separate19.separatorColor = Color.LightGray; separate19.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); mail17.AddView(textView57); mail17.AddView(textView59); mail17.Orientation=(Orientation.Vertical); mail17.Orientation=(Orientation.Vertical); mail6.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail6.SetPadding(20, 10, 10, 10); mail5.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail5.SetPadding(20,10,10,5); mail12.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail12.SetPadding(20,10,10,5); mail13.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail13.SetPadding(20,10,10,5); mail14.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail14.SetPadding(20,10,10,5); mail15.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail15.SetPadding(20,10,10,5); mail16.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail16.SetPadding(20,10,10,5); mail17.LayoutParameters=(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); mail17.SetPadding(20,10,10,5); SeparatorView separate13 = new SeparatorView(context, width * 2); separate13.separatorColor = Color.LightGray; separate13.LayoutParameters=(new ViewGroup.LayoutParams(width * 2, 3)); outboxlayout.SetPadding(20, 0, 20, 20); outboxlayout.AddView(mail5); outboxlayout.AddView(separate13, layoutParams5); outboxlayout.AddView(mail6); outboxlayout.AddView(separate6, layoutParams5); outboxlayout.AddView(mail12); outboxlayout.AddView(separate14, layoutParams5); outboxlayout.AddView(mail13); outboxlayout.AddView(separate15, layoutParams5); outboxlayout.AddView(mail15); outboxlayout.AddView(separate17, layoutParams5); outboxlayout.AddView(mail16); outboxlayout.AddView(separate18, layoutParams5); outboxlayout.AddView(mail17); outboxlayout.AddView(separate19, layoutParams5); img3.Click+= (object sender, EventArgs e) => { ContentFrame.RemoveAllViews(); outboxlayout.RemoveAllViews(); outboxlayout.SetPadding(20, 0, 20, 20); outboxlayout.AddView(mail5); outboxlayout.AddView(separate13, layoutParams5); outboxlayout.AddView(mail6); outboxlayout.AddView(separate6, layoutParams5); outboxlayout.AddView(mail12); outboxlayout.AddView(separate14, layoutParams5); outboxlayout.AddView(mail13); outboxlayout.AddView(separate15, layoutParams5); outboxlayout.AddView(mail15); outboxlayout.AddView(separate17, layoutParams5); outboxlayout.AddView(mail16); outboxlayout.AddView(separate18, layoutParams5); outboxlayout.AddView(mail17); outboxlayout.AddView(separate19, layoutParams5); ContentFrame.AddView(outboxlayout); textView.Text="OutBox"; }; listView.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => { String selitem= arrayAdapter.GetItem(e.Position); if(selitem.Equals("Home")){ ContentFrame.RemoveAllViews(); ContentFrame.AddView(gridLayout); textView.Text="Home"; } if(selitem.Equals("Profile")){ ContentFrame.RemoveAllViews(); ContentFrame.AddView(profilelayout); textView.Text="Profile"; } if(selitem.Equals("Inbox")){ ContentFrame.RemoveAllViews(); inboxLayout.RemoveAllViews(); inboxLayout.SetPadding(20,0,20,20); inboxLayout.AddView(mail1); inboxLayout.AddView(separate4,layoutParams5); inboxLayout.AddView(mail2); inboxLayout.AddView(separate1,layoutParams5); inboxLayout.AddView(mail3); inboxLayout.AddView(separate5,layoutParams5); inboxLayout.AddView(mail4); inboxLayout.AddView(separate3,layoutParams5); inboxLayout.AddView(mail9); inboxLayout.AddView(separate7,layoutParams5); inboxLayout.AddView(mail10); inboxLayout.AddView(separate11,layoutParams5); inboxLayout.AddView(mail11); inboxLayout.AddView(separate10,layoutParams5); ContentFrame.AddView(inboxLayout); textView.Text="Inbox"; } if(selitem.Equals("Outbox")){ ContentFrame.RemoveAllViews(); outboxlayout.RemoveAllViews(); outboxlayout.SetPadding(20, 0, 20, 20); outboxlayout.AddView(mail5); outboxlayout.AddView(separate13, layoutParams5); outboxlayout.AddView(mail6); outboxlayout.AddView(separate6, layoutParams5); outboxlayout.AddView(mail12); outboxlayout.AddView(separate14, layoutParams5); outboxlayout.AddView(mail13); outboxlayout.AddView(separate15, layoutParams5); outboxlayout.AddView(mail15); outboxlayout.AddView(separate17, layoutParams5); outboxlayout.AddView(mail16); outboxlayout.AddView(separate18, layoutParams5); outboxlayout.AddView(mail17); outboxlayout.AddView(separate19, layoutParams5); ContentFrame.AddView(outboxlayout); textView.Text="OutBox"; } if(selitem.Equals("Sent Items")){ ContentFrame.RemoveAllViews(); inboxLayout.RemoveAllViews(); inboxLayout.SetPadding(20,0,20,20); inboxLayout.AddView(mail10); inboxLayout.AddView(separate1,layoutParams5); inboxLayout.AddView(mail9); inboxLayout.AddView(separate5,layoutParams5); inboxLayout.AddView(mail4); inboxLayout.AddView(separate3,layoutParams5); inboxLayout.AddView(mail3); inboxLayout.AddView(separate10,layoutParams5); inboxLayout.AddView(mail11); inboxLayout.AddView(separate4,layoutParams5); inboxLayout.AddView(mail1); inboxLayout.AddView(separate7,layoutParams5); inboxLayout.AddView(mail2); inboxLayout.AddView(separate11,layoutParams5); ContentFrame.AddView(inboxLayout); textView.Text="Sent Items"; } if(selitem.Equals("Trash")){ ContentFrame.RemoveAllViews(); outboxlayout.RemoveAllViews(); outboxlayout.SetPadding(20, 0, 20, 20); outboxlayout.AddView(mail13); outboxlayout.AddView(separate15, layoutParams5); outboxlayout.AddView(mail5); outboxlayout.AddView(separate13, layoutParams5); outboxlayout.AddView(mail12); outboxlayout.AddView(separate14, layoutParams5); outboxlayout.AddView(mail15); outboxlayout.AddView(separate17, layoutParams5); outboxlayout.AddView(mail17); outboxlayout.AddView(separate19, layoutParams5); outboxlayout.AddView(mail16); outboxlayout.AddView(separate18, layoutParams5); outboxlayout.AddView(mail6); outboxlayout.AddView(separate6, layoutParams5); ContentFrame.AddView(outboxlayout); textView.Text="Trash"; } slideDrawer.ToggleDrawer(); }; img1.Click+= (object sender, EventArgs e) => { ContentFrame.RemoveAllViews(); ContentFrame.AddView(profilelayout); textView.Text="Profile"; }; img4.Click+= (object sender, EventArgs e) => { ContentFrame.RemoveAllViews(); inboxLayout.RemoveAllViews(); inboxLayout.SetPadding(20,0,20,20); inboxLayout.AddView(mail10); inboxLayout.AddView(separate1,layoutParams5); inboxLayout.AddView(mail9); inboxLayout.AddView(separate5,layoutParams5); inboxLayout.AddView(mail4); inboxLayout.AddView(separate3,layoutParams5); inboxLayout.AddView(mail3); inboxLayout.AddView(separate10,layoutParams5); inboxLayout.AddView(mail11); inboxLayout.AddView(separate4,layoutParams5); inboxLayout.AddView(mail1); inboxLayout.AddView(separate7,layoutParams5); inboxLayout.AddView(mail2); inboxLayout.AddView(separate11,layoutParams5); ContentFrame.AddView(inboxLayout); textView.Text="Sent Items"; }; img5.Click+= (object sender, EventArgs e) => { ContentFrame.RemoveAllViews(); outboxlayout.RemoveAllViews(); outboxlayout.SetPadding(20, 0, 20, 20); outboxlayout.AddView(mail13); outboxlayout.AddView(separate15, layoutParams5); outboxlayout.AddView(mail5); outboxlayout.AddView(separate13, layoutParams5); outboxlayout.AddView(mail12); outboxlayout.AddView(separate14, layoutParams5); outboxlayout.AddView(mail15); outboxlayout.AddView(separate17, layoutParams5); outboxlayout.AddView(mail17); outboxlayout.AddView(separate19, layoutParams5); outboxlayout.AddView(mail16); outboxlayout.AddView(separate18, layoutParams5); outboxlayout.AddView(mail6); outboxlayout.AddView(separate6, layoutParams5); ContentFrame.AddView(outboxlayout); textView.Text="Trash"; }; return slideDrawer; }
private void ApplyLayoutParams () { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); switch (badgePosition) { case Position.TopLeft: lp.Gravity = GravityFlags.Left | GravityFlags.Top; lp.SetMargins(badgeMarginH, badgeMarginV, 0, 0); break; case Position.TopRight: lp.Gravity = GravityFlags.Right | GravityFlags.Top; lp.SetMargins(0, badgeMarginV, badgeMarginH, 0); break; case Position.BottomLeft: lp.Gravity = GravityFlags.Left | GravityFlags.Bottom; lp.SetMargins(badgeMarginH, 0, 0, badgeMarginV); break; case Position.BottomRight: lp.Gravity = GravityFlags.Right | GravityFlags.Bottom; lp.SetMargins(0, 0, badgeMarginH, badgeMarginV); break; case Position.Center: lp.Gravity = GravityFlags.Center; lp.SetMargins(0, 0, 0, 0); break; default: break; } this.LayoutParameters = lp; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); using (var ignore = new TV.Ouya.Sdk.OuyaInputView(this)) { // do nothing } FrameLayout content = (FrameLayout)FindViewById(Android.Resource.Id.Content); if (null == content) { Log.Info(TAG, "Failed to get content"); return; } RelativeLayout relativeLayout = new RelativeLayout (this); content.AddView (relativeLayout); FrameLayout.LayoutParams relativeLayoutParams = new FrameLayout.LayoutParams (FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); relativeLayout.LayoutParameters = relativeLayoutParams; relativeLayout.SetPadding(0, 0, 0, 0); LinearLayout verticalLayout = new LinearLayout (this); relativeLayout.AddView (verticalLayout); RelativeLayout.LayoutParams verticalLayoutParams = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); verticalLayout.LayoutParameters = verticalLayoutParams; verticalLayout.Orientation = Orientation.Vertical; verticalLayout.SetGravity (GravityFlags.Center); verticalLayout.SetPadding(0, 0, 0, 0); for (int y = 0; y < 2; ++y) { LinearLayout horizontalLayout = new LinearLayout (this); verticalLayout.AddView (horizontalLayout); LinearLayout.LayoutParams horizontalLayoutParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); horizontalLayout.LayoutParameters = horizontalLayoutParams; horizontalLayout.Orientation = Orientation.Horizontal; horizontalLayout.SetGravity (GravityFlags.Center); horizontalLayout.SetPadding(0, 0, 0, 0); int[] resources = { Resource.Drawable.controller, Resource.Drawable.a, Resource.Drawable.dpad_down, Resource.Drawable.dpad_left, Resource.Drawable.dpad_right, Resource.Drawable.dpad_up, Resource.Drawable.lb, Resource.Drawable.lt, Resource.Drawable.l_stick, Resource.Drawable.menu, Resource.Drawable.o, Resource.Drawable.rb, Resource.Drawable.rt, Resource.Drawable.r_stick, Resource.Drawable.thumbl, Resource.Drawable.thumbr, Resource.Drawable.u, Resource.Drawable.y, }; for (int x = 0; x < 2; ++x) { RelativeLayout controllerView = new RelativeLayout (this); horizontalLayout.AddView (controllerView); LinearLayout.LayoutParams controllerLayoutParams = new LinearLayout.LayoutParams (512, 512); controllerView.LayoutParameters = controllerLayoutParams; controllerView.SetGravity (GravityFlags.Center); controllerView.SetPadding(100, 0, 0, 0); Dictionary<int, ImageView> views = new Dictionary<int, ImageView> (); foreach (int resourceId in resources) { ImageView imageView = new ImageView (this); controllerView.AddView (imageView); imageView.SetImageResource (resourceId); views [resourceId] = imageView; } VirtualControllerView controller = new VirtualControllerView (_controllers.Count, views[Resource.Drawable.controller], views[Resource.Drawable.a], views[Resource.Drawable.dpad_down], views[Resource.Drawable.dpad_left], views[Resource.Drawable.dpad_right], views[Resource.Drawable.dpad_up], views[Resource.Drawable.lb], views[Resource.Drawable.lt], views[Resource.Drawable.l_stick], views[Resource.Drawable.menu], views[Resource.Drawable.o], views[Resource.Drawable.rb], views[Resource.Drawable.rt], views[Resource.Drawable.r_stick], views[Resource.Drawable.thumbl], views[Resource.Drawable.thumbr], views[Resource.Drawable.u], views[Resource.Drawable.y]); _controllers.Add (controller); } } ThreadStart ts = new ThreadStart (UpdateWorker); Thread thread = new Thread (ts); thread.Start (); }
protected override void OnLayout(bool changed, int l, int t, int r, int b) { LayoutParameters = new FrameLayout.LayoutParams((int)(_width / 3.2), FrameLayout.LayoutParams.WrapContent); base.OnLayout(changed, l, t, r, b); }
//Java.Lang.Object.Locale localinfo; public override View GetSampleContent (Context con) { Context localcontext = con; int width = con.Resources.DisplayMetrics.WidthPixels -40; FrameLayout frameLayout = new FrameLayout(con); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.FillVertical); frameLayout.LayoutParameters = layoutParams; LinearLayout layout=new LinearLayout(con); layout.LayoutParameters=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layout.SetGravity(GravityFlags.FillVertical); layout.Orientation=Orientation.Vertical; TextView dummy0 = new TextView(con); dummy0.Text="Simple Interest Calculator"; dummy0.Gravity=GravityFlags.Center; dummy0.TextSize=24; layout.AddView(dummy0); TextView dummy7 = new TextView(con); layout.AddView(dummy7); TextView dummy = new TextView(con); dummy.Text="The formula for finding simple interest is:"; dummy.TextSize=18; layout.AddView(dummy); layout.FocusableInTouchMode=true; SpannableStringBuilder builder = new SpannableStringBuilder(); TextView dummy1 = new TextView(con); String str= "Interest"; SpannableString strSpannable= new SpannableString(str); strSpannable.SetSpan(new ForegroundColorSpan(Color.ParseColor("#66BB6A")), 0, str.Length, 0); builder.Append(strSpannable); builder.Append(" = Principal * Rate * Time"); dummy1.SetText(builder, TextView.BufferType.Spannable); dummy1.TextSize=18; layout.AddView(dummy1); TextView dummy8 = new TextView(con); layout.AddView(dummy8); /* Principal amount Stack */ LinearLayout principalStack = new LinearLayout(con); TextView txtPricipal = new TextView(con); txtPricipal.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); txtPricipal.Text="Principal"; principalamount =new SfNumericTextBox(con); principalamount.FormatString="C"; principalamount.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); principalamount.Value=1000; principalamount.AllowNull = true; principalamount.Watermark = "Principal Amount"; principalamount.MaximumNumberDecimalDigits=2; var culture = new Java.Util.Locale("en","US"); principalamount.CultureInfo = culture; principalamount.ValueChangeMode=ValueChangeMode.OnKeyFocus; principalStack.Orientation = Orientation.Horizontal; principalStack.AddView(txtPricipal); principalStack.AddView(principalamount); layout.AddView(principalStack); TextView dummy3 = new TextView(con); layout.AddView(dummy3); /* Interest Input Box */ LinearLayout InterestcalStack = new LinearLayout(con); TextView txtInterest = new TextView(con); txtInterest.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); txtInterest.Text="Interest Rate"; Interestvalue =new SfNumericTextBox(con); Interestvalue.FormatString="P"; Interestvalue.PercentDisplayMode=PercentDisplayMode.Compute; Interestvalue.MaximumNumberDecimalDigits=2; Interestvalue.ValueChangeMode=ValueChangeMode.OnKeyFocus; Interestvalue.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); Interestvalue.Value=0.1f; Interestvalue.Watermark = "Rate of Interest"; Interestvalue.AllowNull = true; Interestvalue.CultureInfo = culture; InterestcalStack.Orientation=Orientation.Horizontal; InterestcalStack.AddView(txtInterest); InterestcalStack.AddView(Interestvalue); layout.AddView(InterestcalStack); TextView dummy2 = new TextView(con); layout.AddView(dummy2); /* Period Input TextBox */ LinearLayout periodStack = new LinearLayout(con); TextView period = new TextView(con); period.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); period.Text="Term"; periodValue =new SfNumericTextBox(con); periodValue.FormatString=" years"; periodValue.MaximumNumberDecimalDigits=0; periodValue.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); periodValue.Value=20; periodValue.Watermark = "Period (in years)"; periodValue.ValueChangeMode=ValueChangeMode.OnKeyFocus; periodValue.CultureInfo = culture; periodValue.AllowNull = true; periodStack.Orientation=Orientation.Horizontal; periodStack.AddView(period); periodStack.AddView(periodValue); layout.AddView(periodStack); /* OutPut values */ LinearLayout outputStack = new LinearLayout(con); TextView outputtxt = new TextView(con); outputtxt.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); outputtxt.Text="Interest"; outputtxt.SetTextColor(Color.ParseColor("#66BB6A")); OutputNumbertxtBox =new SfNumericTextBox(con); OutputNumbertxtBox.FormatString="c"; OutputNumbertxtBox.MaximumNumberDecimalDigits=0; OutputNumbertxtBox.AllowNull=true; OutputNumbertxtBox.CultureInfo = culture; OutputNumbertxtBox.Watermark="Enter Values"; OutputNumbertxtBox.Clickable=false; OutputNumbertxtBox.Value = (float)(1000 * 0.1 * 20); OutputNumbertxtBox.Enabled=false; OutputNumbertxtBox.LayoutParameters=new ViewGroup.LayoutParams(width / 2, 100); OutputNumbertxtBox.ValueChangeMode=ValueChangeMode.OnLostFocus; outputStack.Orientation=Orientation.Horizontal; outputStack.AddView(outputtxt); outputStack.AddView(OutputNumbertxtBox); layout.AddView(outputStack); TextView dummy4 = new TextView(con); layout.SetPadding(20, 20, 10, 20); layout.AddView(dummy4); principalamount.ValueChanged+= (object sender, SfNumericTextBox.ValueChangedEventArgs e) => { if(!e.P1.ToString().Equals("")&&!periodValue.Value.ToString().Equals("")&&!Interestvalue.Value.ToString().Equals("")) OutputNumbertxtBox.Value=e.P1 * periodValue.Value * Interestvalue.Value; }; periodValue.ValueChanged+= (object sender, SfNumericTextBox.ValueChangedEventArgs e) => { if(!e.P1.ToString().Equals("")&&!principalamount.Value.ToString().Equals("")&&!Interestvalue.Value.ToString().Equals("")) OutputNumbertxtBox.Value=e.P1* principalamount.Value*Interestvalue.Value; }; Interestvalue.ValueChanged+= (object sender, SfNumericTextBox.ValueChangedEventArgs e) => { if(!e.P1.ToString().Equals("")&&!principalamount.Value.ToString().Equals("")&&!periodValue.Value.ToString().Equals("")) OutputNumbertxtBox.Value=e.P1 * principalamount.Value * periodValue.Value; }; layout.Touch+= (object sender, View.TouchEventArgs e) => { if(OutputNumbertxtBox.IsFocused || Interestvalue.IsFocused ||periodValue.IsFocused || principalamount.IsFocused){ Rect outRect = new Rect(); OutputNumbertxtBox.GetGlobalVisibleRect(outRect); Interestvalue.GetGlobalVisibleRect(outRect); periodValue.GetGlobalVisibleRect(outRect); principalamount.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { if(!OutputNumbertxtBox.Value.ToString().Equals("")) OutputNumbertxtBox.ClearFocus(); if(!Interestvalue.Value.ToString().Equals("")) Interestvalue.ClearFocus(); if(!periodValue.Value.ToString().Equals("")) periodValue.ClearFocus(); if(!principalamount.Value.ToString().Equals("")) principalamount.ClearFocus(); } hideSoftKeyboard((Activity)localcontext); } }; frameLayout.AddView(layout); ScrollView scrollView = new ScrollView(con); scrollView.AddView(frameLayout); return scrollView; }