Esempio n. 1
0
            public PickerCellView(Context context, Cell cell) : base(context)
            {
                _cell = cell;
                SetMinimumWidth((int)context.ToPixels(50));
                SetMinimumHeight((int)context.ToPixels(36));
                Orientation = Orientation.Horizontal;

                var padding = (int)context.ToPixels(8);

                SetPadding((int)context.ToPixels(15), padding, padding, padding);

                _label = new ATextView(context);
                Android.Support.V4.Widget.TextViewCompat.SetTextAppearance(_label, Android.Resource.Style.TextAppearanceSmall);
                _label.SetWidth((int)context.ToPixels(80));

                var layoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                {
                    Gravity = GravityFlags.CenterVertical
                };

                using (layoutParams)
                    AddView(_label, layoutParams);

                EditText                       = new EditText(context);
                EditText.KeyListener           = null;
                EditText.OnFocusChangeListener = this;
                //editText.SetBackgroundDrawable (null);
                layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
                {
                    Width = 0, Weight = 1, Gravity = GravityFlags.FillHorizontal | GravityFlags.Center
                };
                using (layoutParams)
                    AddView(EditText, layoutParams);
            }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new FrameLayout(this);

            surface = UrhoSurface.CreateSurface(this, typeof(MySample));
            //surface.Background.SetAlpha(10);

            TextView txtView = new TextView(this);
            txtView.SetBackgroundColor(Color.Violet);
            txtView.SetWidth(10);
            txtView.SetHeight(10);

            txtView.Text = "HAHAH";
            //txtView.Text = surface.Background.ToString();
            Button btn = new Button(this);
            btn.SetBackgroundColor(Color.Transparent);
            btn.Text = "Button";
            btn.SetHeight(100);
            btn.SetWidth(100);
            btn.SetX(30);
            btn.SetY(30);
            btn.TextAlignment = TextAlignment.Center;
            mLayout.AddView(txtView);
            mLayout.AddView(btn);
            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
Esempio n. 3
0
 private void Initialize()
 {
     var text = new TextView(Context);
     text.SetHeight(500);
     text.SetWidth(200);
     text.SetText(Resource.String.FooWidgetText);
     AddView(text);
 }
Esempio n. 4
0
 public override ViewHolder OnCreateViewHolder(ViewGroup parent)
 {
     var textView = new TextView(parent.Context);
     textView.SetWidth (200);
     textView.Focusable = true;
     textView.FocusableInTouchMode = true;
     textView.Text = "";
     return new ViewHolder(textView);
 }
Esempio n. 5
0
		// Create new views (invoked by the layout manager)
		public override RecyclerView.ViewHolder OnCreateViewHolder (ViewGroup parent, int viewType)
		{	
            // set the view's size, margins, paddings and layout parameters
			var tv = new TextView (parent.Context);
			tv.SetWidth (200);
			tv.Text = "";

			var vh = new MyViewHolder (tv);
			return vh;
		} 
		public override View GetPropertyWindowLayout (Android.Content.Context context)
		{
			int width = context.Resources.DisplayMetrics.WidthPixels / 2;
			propertylayout = new LinearLayout(context);
			propertylayout.Orientation = Orientation.Vertical;
			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParams.SetMargins(0, 20, 0, 0);
			//SuggestionMode
			TextView textView1 = new TextView(context);
			textView1.Text = "Suggestion Mode";
			textView1.TextSize=20;
			textView1.Gravity  = GravityFlags.Left;
			TextView textview2 = new TextView(context);
			propertylayout.AddView(textview2);
			spinner1 = new Spinner(context);
			//spinner1.Gravity  = GravityFlags.Left;
			propertylayout.AddView(textView1);
			propertylayout.AddView(spinner1);
			List<String> list = new List<String>();
			list.Add("StartsWith");
			list.Add("StartsWithCaseSensitive");
			list.Add("Contains");
			list.Add("ContainsWithCaseSensitive");
			list.Add("EndsWith");
			list.Add("EndsWithCaseSensitive");
			list.Add("Equals");
			list.Add("EqualsWithCaseSensitive");
			//list.add("None");

			dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			spinner1.Adapter = dataAdapter;

			spinner1.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem (e.Position);
				
				if (selectedItem.Equals ("StartsWith")) {
					suggestionModes = SuggestionMode.StartsWith;
									
				} else if (selectedItem.Equals ("StartsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.StartsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Contains")) {
					suggestionModes = SuggestionMode.Contains;
									
				} else if (selectedItem.Equals ("ContainsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.ContainsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("EndsWith")) {
					suggestionModes = SuggestionMode.EndsWith;
										
				} else if (selectedItem.Equals ("EndsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EndsWithCaseSensitive;
										
				} else if (selectedItem.Equals ("Equals")) {
					suggestionModes = SuggestionMode.Equals;
										
				} else if (selectedItem.Equals ("EqualsWithCaseSensitive")) {
					suggestionModes = SuggestionMode.EqualsWithCaseSensitive;
										
				}
			};
			//Separator 1
			SeparatorView separate = new SeparatorView(context, width * 2);
			separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParam1 = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParam1.SetMargins(0, 20, 0, 0);
			propertylayout.AddView(separate,layoutParam1);

			//AutoCompleteMode
			TextView textV1 = new TextView(context);
			textV1.Text = "AutoComplete Mode";
			textV1.TextSize=20;
			textV1.Gravity = GravityFlags.Left;
			TextView textv2 = new TextView(context);
			propertylayout.AddView(textv2);
			text3 = new Spinner(context);
			propertylayout.AddView(textV1);
			propertylayout.AddView(text3);
			List<String> list1 = new List<String>();
			list1.Add("Suggest");
			list1.Add("SuggestAppend");
			list1.Add("Append");

			dataadapter1 = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list1);
			dataadapter1.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			text3.Adapter = dataadapter1;

			text3.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataadapter1.GetItem(e.Position);
									if (selectedItem.Equals("Suggest")) {
										autoCompleteMode = AutoCompleteMode.Suggest;
										
									} else if (selectedItem.Equals("SuggestAppend")) {
										autoCompleteMode = AutoCompleteMode.SuggestAppend;
										
									} else if (selectedItem.Equals("Append")) {
										autoCompleteMode = AutoCompleteMode.Append;
										
									}
			};

			//Separator 2
			SeparatorView separate1 = new SeparatorView(context, width * 2);
			separate1.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);

			LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(
				width * 2, 5);
			layoutParams2.SetMargins(0, 20, 0, 0);
			propertylayout.SetPadding(15, 0, 15, 0);

			//Separator 2
			SeparatorView separate2 = new SeparatorView(context, width * 2);
			separate2.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			propertylayout.AddView(separate2, layoutParams2);

			//Min Prefix Character
			TextView textView7 = new TextView(context);
			textView7.Text = "Min Prefix Character";
			textView7.SetWidth(400);
			textView7.TextSize=20;
			etext1 = new EditText(context);
			etext1.Text = "1";
			etext1.TextSize=16;
			etext1.InputType = Android.Text.InputTypes.ClassPhone;
			etext1.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext1.Text.Length > 0)
					minimum =  Convert.ToInt32(e.Text.ToString());
				else
					minimum = 1;
			};

			LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams7.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams8.SetMargins(0, 10, 0, 0);
			stackView2 = new LinearLayout(context);
			stackView2.AddView(textView7,layoutParams8);
			stackView2.AddView(etext1, layoutParams7);
			stackView2.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView2);
			SeparatorView separate4 = new SeparatorView(context, width * 2);
			separate4.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams6.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate4, layoutParams6);

			//max DropDown height
			TextView textView8 = new TextView(context);
			textView8.Text = "Max DropDown Height";
			textView8.SetWidth(400);
			textView8.TextSize=20;
			etext2 = new EditText(context);
			etext2.Text = "200";
			etext2.TextSize=16;
			etext2.InputType = Android.Text.InputTypes.ClassPhone;
			etext2.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext2.Text.Length>0)
					maximum =  Convert.ToInt32(e.Text.ToString());
				else
					maximum = 200;
			};

			LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams9.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams10 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams10.SetMargins(0, 10, 0, 0);
			stackView3 = new LinearLayout(context);
			stackView3.AddView(textView8,layoutParams10);
			stackView3.AddView(etext2, layoutParams9);
			stackView3.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView3);
			SeparatorView separate5 = new SeparatorView(context, width * 2);
			separate5.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams11 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams11.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate5, layoutParams11);

			//Popup Delay
			TextView textView9 = new TextView(context);
			textView9.Text = "PopUp Delay";
			textView9.SetWidth(400);
			textView9.TextSize=20;
			etext3 = new EditText(context);
			etext3.Text = "100";
			etext3.TextSize=16;
			etext3.InputType = Android.Text.InputTypes.ClassPhone;
			etext1.SetWidth(50);
			etext2.SetWidth(50);
			etext3.SetWidth(50);

			etext3.TextChanged+= (object sender, Android.Text.TextChangedEventArgs e) => 
			{
				if(etext3.Text.Length>0)
					popupdelay=  Convert.ToInt32(e.Text.ToString());
				else
					popupdelay = 100;
			};
			LinearLayout.LayoutParams layoutParams12 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams12.SetMargins(0, 10, 0, 0);
			LinearLayout.LayoutParams layoutParams13 = new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams13.SetMargins(0, 10, 0, 0);
			stackView4 = new LinearLayout(context);
			stackView4.AddView(textView9,layoutParams13);
			stackView4.AddView(etext3, layoutParams12);
			stackView4.Orientation = Orientation.Horizontal;
			propertylayout.AddView(stackView4);
			SeparatorView separate6 = new SeparatorView(context, width * 2);
			separate6.LayoutParameters=new ViewGroup.LayoutParams(width * 2, 5);
			LinearLayout.LayoutParams layoutParams14 = new LinearLayout.LayoutParams(width * 2, 5);
			layoutParams14.SetMargins(0, 20, 15, 0);
			propertylayout.AddView(separate6, layoutParams14);

			return propertylayout;

		}
 public void UpdateHeader(IEnumerable<StockDataItem> configItems)
 {
     QuoteListviewHeader.RemoveAllViews();
     var cellwidth = this.GetScreenWidth() / configItems.Count();
     foreach (var stockDataItem in configItems)
     {
         var textItem = new TextView(this);
         textItem.Text = stockDataItem.GetStringValue();
         textItem.TextSize = 16.55F;
         textItem.SetWidth(cellwidth);
         textItem.SetTextColor(Resources.GetColor(Android.Resource.Color.Black));
         QuoteListviewHeader.AddView(textItem);
     }
     QuoteListviewHeader.SetBackgroundResource(Android.Resource.Color.BackgroundLight);
 }