public void BuildScreen() { OverAllLayout = FindViewById <LinearLayout>(Resource.Id.Layout); InsideSVLayout = new LinearLayout(this); InsideSVLayout.LayoutParameters = new LinearLayout.LayoutParams(1320, 780); InsideSVLayout.Orientation = Orientation.Vertical; SV = new ScrollView(this); SV.LayoutParameters = matchParams; SV.CanScrollHorizontally(-1); MyImageButton[,] arr = new MyImageButton[13, 22]; for (int i = 0; i < arr.GetLength(0) - 1; i++) { lay = new LinearLayout(this); lay.LayoutParameters = WrapParams; lay.Orientation = Orientation.Horizontal; lay.SetGravity(GravityFlags.CenterHorizontal); for (int k = 0; k < arr.GetLength(1) - 1; k++) { arr[i, k] = new MyImageButton(this, i, k); arr[i, k].SetImageResource(Resource.Drawable.Chair); arr[i, k].SetBackgroundColor(Color.MediumSeaGreen); Imageparams.SetMargins(5, 5, 5, 5); arr[i, k].LayoutParameters = Imageparams; arr[i, k].SetScaleType(ImageView.ScaleType.FitCenter); arr[i, k].SetAdjustViewBounds(true); arr[i, k].Click += this.MainActivity_Click; lay.AddView(arr[i, k]); } InsideSVLayout.AddView(lay); } SV.AddView(InsideSVLayout); OverAllLayout.AddView(SV); }
private void MainActivity_Click(object sender, System.EventArgs e) { MyImageButton imgbtn = (MyImageButton)sender; imgbtn.SetBackgroundColor(Color.Red); imgbtn.Clickable = false; currI = imgbtn.i + 1; currK = imgbtn.k + 1; BuildDialog(); }