当前位置: 首页>>代码示例>>C#>>正文


C# View.SetBackgroundColor方法代码示例

本文整理汇总了C#中Android.Views.View.SetBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetBackgroundColor方法的具体用法?C# View.SetBackgroundColor怎么用?C# View.SetBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Views.View的用法示例。


在下文中一共展示了View.SetBackgroundColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView (Resource.Layout.dialog_color_picker);

            mHuePicker =  FindViewById<HueBarSlider>(Resource.Id.hue_slider);
            mColorAreaPicker =  FindViewById<ColorAreaPicker>(Resource.Id.color_area_picker);
            Button okButton =  FindViewById<Button>(Resource.Id.ok_button);
            Button cancelButton =  FindViewById<Button>(Resource.Id.cancel_button);
            mCurrentColorPreview = FindViewById(Resource.Id.current_color);
            mSelectedColorPreview = FindViewById(Resource.Id.selected_color);

            mCurrentColorPreview.SetBackgroundColor(mInitialColor);
            mSelectedColorPreview.SetBackgroundColor(mInitialColor);

            mColorAreaPicker.ColorChanged += (sender, args) =>
            {
                mSelectedColor = args.Color;
                mSelectedColorPreview.SetBackgroundColor(mSelectedColor);
            };
            mColorAreaPicker.SetHuePicker(mHuePicker);
            mColorAreaPicker.SetColor(mInitialColor);

            okButton.Click += delegate
            {
                OnColorSelected(new ColorChangedEventArgs(mSelectedColor));
                Dismiss();
            };

            cancelButton.Click += delegate
            {
                Cancel();
            };
        }
开发者ID:King-of-Spades,项目名称:xamarin-samples,代码行数:34,代码来源:ColorPickerDialog.cs

示例2: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState, Resource.Layout.product_list_activity);

            SetTitle(Resource.String.choose_product);

            useProductDetailsActivity = false;
            theme = new ProductDetailsTheme(Resources);

            if (Intent.HasExtra(ExtraCollectionId))
            {
                collectionId = Intent.GetStringExtra(ExtraCollectionId);
            }

            productViewOptionsContainer = FindViewById(Resource.Id.product_view_options_container);
            productViewOptionsContainer.Visibility = ViewStates.Gone;

            FindViewById<Switch>(Resource.Id.product_details_activity_switch).CheckedChange += (sender, e) =>
            {
                useProductDetailsActivity = e.IsChecked;
                productViewOptionsContainer.Visibility = e.IsChecked ? ViewStates.Visible : ViewStates.Gone;
            };

            FindViewById<Switch>(Resource.Id.theme_style_switch).CheckedChange += (sender, e) =>
            {
                theme.SetStyle(e.IsChecked ? ProductDetailsTheme.Style.Light : ProductDetailsTheme.Style.Dark);
            };

            FindViewById<Switch>(Resource.Id.product_image_bg_switch).CheckedChange += (sender, e) =>
            {
                theme.SetShowProductImageBackground(e.IsChecked);
            };

            accentColorView = FindViewById(Resource.Id.accent_color_view);
            accentColorView.SetBackgroundColor(new Color(theme.AccentColor));
            accentColorView.Click += delegate
            {
                var cpd = new HSVColorPickerDialog(this, new Color(theme.AccentColor), (color) =>
                {
                    theme.AccentColor = color;
                    accentColorView.SetBackgroundColor(color);
                });
                cpd.SetTitle(Resource.String.choose_accent_color);
                cpd.Show();
            };
        }
开发者ID:mattleibow,项目名称:shopify-bindings,代码行数:46,代码来源:ProductListActivity.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            //create a new beacon manager to handle starting and stopping ranging
            beaconManager = new BeaconManager (this);

            //major and minor are optional, pass in null if you don't need them
            beaconRegion = new EstimoteSdk.Region (beaconId, uuid, null, null);

            var v = FindViewById<WatchViewStub> (Resource.Id.watch_view_stub);

            v.LayoutInflated += delegate {

                // Get our button from the layout resource,
                // and attach an event to it
                background = FindViewById<View> (Resource.Id.main);
                count = FindViewById<TextView>(Resource.Id.text);
            };

            beaconManager.Ranging += (object sender, BeaconManager.RangingEventArgs e) => RunOnUiThread (() => {

                background.SetBackgroundColor(Color.Black);
                count.Text = e.Beacons.Count.ToString();
                if(e.Beacons.Count == 0)
                    return;

                var prox = Utils.ComputeProximity(e.Beacons[0]);
                if(prox == Utils.Proximity.Far)
                    background.SetBackgroundColor(Color.Blue);
                else if(prox == Utils.Proximity.Near)
                    background.SetBackgroundColor(Color.Yellow);
                else if(prox == Utils.Proximity.Immediate)
                    background.SetBackgroundColor(Color.Green);
                else
                    background.SetBackgroundColor(Color.Black);

            });
        }
开发者ID:stronachconsult,项目名称:iBeaconsEverywhere,代码行数:42,代码来源:MainActivity.cs

示例4: HSVColorPickerDialog

        public HSVColorPickerDialog(Context context, Color initialColor, Action<Color> listener)
            : base(context)
        {
            this.selectedColor = initialColor;
            this.listener = listener;

            colorWheel = new HSVColorWheel(context);
            valueSlider = new HSVValueSlider(context);
            var padding = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP);
            var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP);
            var layout = new RelativeLayout(context);

            var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            colorWheel.setListener((color) => valueSlider.SetColor(color, true));
            colorWheel.setColor(initialColor);
            colorWheel.Id = (1);
            layout.AddView(colorWheel, lp);

            int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP);

            var valueSliderBorder = new FrameLayout(context);
            valueSliderBorder.SetBackgroundColor(BORDER_COLOR);
            valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            valueSliderBorder.Id = (2);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            lp.AddRule(LayoutRules.Below, 1);
            layout.AddView(valueSliderBorder, lp);

            valueSlider.SetColor(initialColor, false);
            valueSlider.SetListener((color) =>
            {
                selectedColor = color;
                selectedColorView.SetBackgroundColor(color);
            });
            valueSliderBorder.AddView(valueSlider);

            var selectedColorborder = new FrameLayout(context);
            selectedColorborder.SetBackgroundColor(BORDER_COLOR);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            lp.AddRule(LayoutRules.Below, 2);
            layout.AddView(selectedColorborder, lp);

            selectedColorView = new View(context);
            selectedColorView.SetBackgroundColor(selectedColor);
            selectedColorborder.AddView(selectedColorView);

            SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener);
            SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener);

            SetView(layout, padding, padding, padding, padding);
        }
开发者ID:mattleibow,项目名称:shopify-bindings,代码行数:54,代码来源:HSVColorPickerDialog.cs

示例5: TestResultsGroupView

        public TestResultsGroupView(Context context, TestRunInfo testRunInfo) : base(context)
        {
            var indicatorView = new View(context)
            {
                LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 60,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                }
            };
            indicatorView.SetBackgroundColor(
                testRunInfo.IsIgnored ? Color.Yellow
                : testRunInfo.Running ? Color.Gray
                : testRunInfo.Passed ? Color.Green
                : Color.Red);
            AddView(indicatorView);

            var container = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
            };
            AddView(container);

            var text1 = new TextView(context)
            {
                Text = testRunInfo.Description,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text1.SetTextSize(ComplexUnitType.Sp, 22);
            text1.SetSingleLine(true);
            text1.SetPadding(2, 2, 2, 2);
            container.AddView(text1);

            var text2 = new TextView(context)
            {
                Text = testRunInfo.TestCaseName,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text2.SetTextSize(ComplexUnitType.Sp, 14);
            text2.SetSingleLine(true);
            text2.SetPadding(2, 2, 2, 2);
            container.AddView(text2);
        }
开发者ID:skela,项目名称:NUnitLite.MonoDroid,代码行数:52,代码来源:TestResultsGroupView.cs

示例6: StyleBGLayer

        public static void StyleBGLayer( View backgroundLayout )
        {
            backgroundLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

            View borderView = backgroundLayout.FindViewById<View>( Resource.Id.top_border );
            if ( borderView != null )
            {
                borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
            }

            borderView = backgroundLayout.FindViewById<View>( Resource.Id.bottom_border );
            if ( borderView != null )
            {
                borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
            }
        }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:16,代码来源:ControlStyling.cs

示例7: GetView

		public override View GetView (int position, View convertView, ViewGroup parent)
		{
			if (convertView == null) {
				convertView = layoutInflater.Inflate (Resource.Layout.item_category, parent, false);
				convertView.Tag = new CategoryViewHolder ((LinearLayout)convertView);
			}
			var holder = (CategoryViewHolder)convertView.Tag;
			var category = (Category)GetItem (position);
			var theme = category.Theme;
			SetCategoryIcon (category, holder.Icon);
			convertView.SetBackgroundColor (GetColor (theme.WindowBackgroundColor));
			holder.Title.Text = category.Name;
			holder.Title.SetTextColor (GetColor ((theme.TextPrimaryColor)));
			holder.Title.SetBackgroundColor (GetColor (theme.PrimaryColor));
			return convertView;
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:16,代码来源:CategoryAdapter.cs

示例8: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.ColorSelect);

            r = FindViewById<SeekBar>(Resource.Id.seekBarR);
            g = FindViewById<SeekBar>(Resource.Id.seekBarG);
            b = FindViewById<SeekBar>(Resource.Id.seekBarB);
            col = FindViewById<View>(Resource.Id.viewColor);
            ImageButton back = FindViewById<ImageButton>(Resource.Id.imageButtonBack);

            Bundle bun = Intent.GetBundleExtra("color");
            byte[] rgb = bun.GetByteArray("color");
            color = new Color(rgb.ElementAt(0), rgb.ElementAt(1), rgb.ElementAt(2));
            col.SetBackgroundColor(color);
            r.Progress = (color.R * 100) / 255;
            g.Progress = (color.G * 100) / 255;
            b.Progress = (color.B * 100) / 255;

            back.Click += BackToMain;
            r.ProgressChanged += UpdateColor;
        }
开发者ID:evelinemart,项目名称:App1,代码行数:24,代码来源:ColorSelectActivity.cs

示例9: ListItem

                public ListItem( Context context ) : base( context )
                {
                    Orientation = Android.Widget.Orientation.Vertical;

                    SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );

                    LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    contentLayout.Orientation = Android.Widget.Orientation.Horizontal;
                    contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
                    AddView( contentLayout );

                    Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Thumbnail.LayoutParameters = new LinearLayout.LayoutParams( (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ), (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ) );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    Thumbnail.SetScaleType( ImageView.ScaleType.CenterCrop );
                    contentLayout.AddView( Thumbnail );

                    TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TitleLayout.Orientation = Android.Widget.Orientation.Vertical;
                    TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    contentLayout.AddView( TitleLayout );



                    Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
                    Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                    Title.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
                    TitleLayout.AddView( Title );

                    SubTitle = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SubTitle.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SubTitle.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SubTitle.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SubTitle.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 );
                    TitleLayout.AddView( SubTitle );

                    // fill the remaining space with a dummy view, and that will align our chevron to the right
                    View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 );
                    ( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1;
                    contentLayout.AddView( dummyView );

                    Chevron = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Chevron.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)Chevron.LayoutParameters ).Gravity = GravityFlags.CenterVertical | GravityFlags.Right;
                    Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
                    Chevron.SetTypeface(  fontFace, TypefaceStyle.Normal );
                    Chevron.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize );
                    Chevron.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon;
                    contentLayout.AddView( Chevron );

                    // add our own custom seperator at the bottom
                    Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
                    AddView( Seperator );
                }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:70,代码来源:ConnectPrimaryFragment.cs

示例10: Initialize

		void Initialize ()
		{
			this.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			this.Orientation = Orientation.Vertical;

			linea_separador = new View (context);
			linea_separador.LayoutParameters = new ViewGroup.LayoutParams (-1, 5);
			linea_separador.SetBackgroundColor (Color.ParseColor ("#eeeeee"));

			imgUser = new ImageView (context);
			scrollImage = new HorizontalScrollView (context);
			scrollImage.HorizontalScrollBarEnabled = false;
			linearImage = new LinearLayout (context);
			linearPanelScroll = new LinearLayout (context);
			linearContainer = new LinearLayout (context);
			linearAll = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtContainer = new TextView (context);
			txtTitle = new TextView (context);


			linearAll.LayoutParameters = new LinearLayout.LayoutParams (-1,-2);
			linearImage.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(140),-2);
			linearContainer.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(500),-2);
			linearPanelScroll.LayoutParameters = new LinearLayout.LayoutParams (-2,-2);
			scrollImage.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (500), -2);


			linearAll.Orientation = Orientation.Horizontal;
			linearImage.Orientation = Orientation.Vertical;
			linearContainer.Orientation = Orientation.Vertical;

			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight(40));
			txtAuthor.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
			txtContainer.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (45));
			txtAuthor.SetTextColor (Color.ParseColor("#3c3c3c"));
			txtContainer.SetTextColor (Color.ParseColor("#3c3c3c"));

			txtTitle.SetSingleLine (true);
			txtAuthor.SetSingleLine (true);
			txtContainer.SetSingleLine (false);
			txtContainer.SetPadding (0, 0, 20, 0);
			txtContainer.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");
			txtAuthor.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");

			scrollImage.AddView (linearPanelScroll);
			linearAll.AddView (linearImage);
			linearAll.AddView (linearContainer);

			linearImage.AddView (imgUser);

			linearContainer.AddView (txtTitle);
			linearContainer.AddView (txtAuthor);
			linearContainer.AddView (txtContainer);
			linearContainer.AddView (scrollImage);

			int space = Configuration.getHeight (50);



			scrollImage.SetPadding (0, 0, 0, space);
			this.AddView (linearAll);
			this.AddView (linea_separador);
			this.SetPadding (0, 0,0, space);


		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:68,代码来源:ChapterContainerView.cs

示例11: OnDrag

    public bool OnDrag(View view, DragEvent dragEvent)
    {
      bool result = true;

      MoveDragData dragData = null;
      if (dragEvent.LocalState is MoveDragData)
      {
        dragData = dragEvent.LocalState as MoveDragData;
      }
      else
      {
        if (Successor is View.IOnDragListener)
        {
          return (Successor as View.IOnDragListener).OnDrag(view, dragEvent);
        }
      }

      switch (dragEvent.Action)
      {
        case DragEvent.ACTION_DRAG_STARTED:
          break;
        case DragEvent.ACTION_DRAG_ENTERED:

          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.accent_blue));
          //float[] single = { 1.0F, 0.5F };
          //anim = ObjectAnimator.OfFloat((Object)view, "alpha", single);
          //anim.SetInterpolator(new CycleInterpolator(40));
          //anim.SetDuration(30 * 1000); // 30 seconds
          //anim.Start();
          break;
        case DragEvent.ACTION_DRAG_ENDED:
        case DragEvent.ACTION_DRAG_EXITED:
          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}
          break;
        case DragEvent.ACTION_DROP:
          view.SetBackgroundColor(view.Context.Resources.GetColor(R.Color.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}

          // Dropped, reassign View to ViewGroup
          var dragedView = dragData.draggedView;
          ViewGroup owner = (ViewGroup)dragedView.Parent;
          owner.RemoveView(dragedView);
          //LinearLayout container = (LinearLayout)view;
          HorizontalFlowLayout container = (HorizontalFlowLayout)view;
          container.AddView(dragedView);
          dragedView.Visibility = (View.VISIBLE);

          // Inform all listeners
          OnMoveDropAccepted(dragData.dragHandler.CurrentContainer, Id, (dragData as MoveDragData).dragHandler.CheckerData);
          // Set as currentContainer
          dragData.dragHandler.CurrentContainer = Id;

          break;
        case DragEvent.ACTION_DRAG_LOCATION:
          break;
        default:
          break;
      }

      return result;
    }
开发者ID:Xtremrules,项目名称:dot42,代码行数:70,代码来源:MoveDropHandler.cs

示例12: MessageListItem

                public MessageListItem( Context context ) : base( context )
                {
                    SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
                    LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );

                    Orientation = Orientation.Vertical;

                    LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
                    contentLayout.Orientation = Orientation.Horizontal;
                    AddView( contentLayout );

                    TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent );
                    TitleLayout.Orientation = Orientation.Vertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
                    contentLayout.AddView( TitleLayout );

                    Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
                    Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
                    Title.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( Title );

                    Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    TitleLayout.AddView( Date );

                    Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    ( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    Speaker.SetMaxLines( 1 );
                    TitleLayout.AddView( Speaker );

                    // add our own custom seperator at the bottom
                    View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    seperator.LayoutParameters.Height = 2;
                    seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
                    AddView( seperator );


                    // setup the buttons
                    LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
                    ( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1;
                    buttonLayout.Orientation = Orientation.Horizontal;
                    contentLayout.AddView( buttonLayout );

                    Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );

                    ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon;
                    ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    ListenButton.Background = null;
                    buttonLayout.AddView( ListenButton );

                    WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon;
                    WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    WatchButton.Background = null;
                    buttonLayout.AddView( WatchButton );

                    TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
                    TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
                    TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon;
                    TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
                    TakeNotesButton.Background = null;
                    buttonLayout.AddView( TakeNotesButton );

                    ListenButton.Click += (object sender, EventArgs e ) =>
                        {
//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:101,代码来源:NotesDetailsFragment.cs

示例13: OnCreateView

                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    GroupEntries = new List<GroupFinder.GroupEntry>();
                    MarkerList = new List<Android.Gms.Maps.Model.Marker>();
                    SourceLocation = new GroupFinder.GroupEntry();

                    // limit the address to 90% of the screen so it doesn't conflict with the progress bar.
                    Point displaySize = new Point( );
                    Activity.WindowManager.DefaultDisplay.GetSize( displaySize );
                    //float fixedWidth = displaySize.X / 4.0f;

                    // catch any exceptions thrown, as they'll be related to no map API key
                    try
                    {
                        MapView = new Android.Gms.Maps.MapView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                        MapView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                        MapView.LayoutParameters.Height = (int) (displaySize.Y * .50f);
                        MapView.GetMapAsync( this );
                        MapView.SetBackgroundColor( Color.Black );

                        MapView.OnCreate( savedInstanceState );
                    }
                    catch
                    {
                        MapView = null;
                        Rock.Mobile.Util.Debug.WriteLine( "GOOGLE MAPS: Unable to create. Verify you have a valid API KEY." );
                    }


                    SearchAddressButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    ControlStyling.StyleButton( SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
                    SearchAddressButton.Click += (object sender, EventArgs e ) =>
                    {
                            SearchPage.Show( );
                    };


                    // setup the linear layout containing the "Your Neighborhood is: Horizon" text
                    SearchLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchLayout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    SearchLayout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
                    SearchLayout.SetGravity( GravityFlags.Center );

                    SearchResultPrefix = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultPrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultPrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultPrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                    SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;

                    SearchResultNeighborhood = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    SearchResultNeighborhood.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
                    SearchResultNeighborhood.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
                    SearchResultNeighborhood.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                    SearchResultNeighborhood.Text = "";


                    Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );

                    ListView = new ListView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ListView.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e ) =>
                        {
                            OnClick( e.Position, 0 );
                        };
                    ListView.SetOnTouchListener( this );
                    ListView.Adapter = new GroupArrayAdapter( this );

                    View view = inflater.Inflate(Resource.Layout.Connect_GroupFinder, container, false);
                    view.SetOnTouchListener( this );

                    view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

                    LinearLayout groupLayout = view.FindViewById<LinearLayout>( Resource.Id.groupFrame ) as LinearLayout;

                    // setup the address layout, which has the address text, padding, and finally the progress bar.
                    if ( MapView != null )
                    {
                        ( (LinearLayout)groupLayout ).AddView( MapView );
                    }

                    ((LinearLayout)groupLayout).AddView( SearchAddressButton );

                    ((LinearLayout)groupLayout).AddView( SearchLayout );
                    ((LinearLayout)SearchLayout).AddView( SearchResultPrefix );
                    ((LinearLayout)SearchLayout).AddView( SearchResultNeighborhood );

                    ((LinearLayout)groupLayout).AddView( Seperator );
                    ((LinearLayout)groupLayout).AddView( ListView );
//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:101,代码来源:GroupFinderFragment.cs

示例14: MakeText

        private static AppMsg MakeText(Activity context, String text, Style style, View view, bool floating, float textSize, View.IOnClickListener clickListener)
        {
            AppMsg result = new AppMsg(context);

            view.SetBackgroundColor(style.BackgroundColor);
            view.Clickable = true;

            TextView tv = view.FindViewById<TextView>(Android.Resource.Id.Message);
            if (textSize > 0)
            {
                tv.SetTextSize(Android.Util.ComplexUnitType.Sp, textSize);
            }
            else
            {
                tv.SetTextSize(Android.Util.ComplexUnitType.Dip, TEXTSIZE);
            }
            tv.Text = text;
            tv.SetTextColor(style.TextColor);

            result.mView = view;
            result.mDuration = style.Duration;
            result.mFloating = floating;

            view.SetOnClickListener(clickListener);
            return result;
        }
开发者ID:CSharpCross,项目名称:AppMsg,代码行数:26,代码来源:AppMsg.cs

示例15: Initialize

		void Initialize ()
		{
			BackgroundColor = Color.Black;
			strokeColor = Color.White;
			StrokeWidth = 2f;

			canvasView = new SignatureCanvasView (this.context);
			canvasView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);

			//Set the attributes for painting the lines on the screen.
			paint = new Paint ();
			paint.Color = strokeColor;
			paint.StrokeWidth = StrokeWidth;
			paint.SetStyle (Paint.Style.Stroke);
			paint.StrokeJoin = Paint.Join.Round;
			paint.StrokeCap = Paint.Cap.Round;
			paint.AntiAlias = true;

			#region Add Subviews
			RelativeLayout.LayoutParams layout;

			BackgroundImageView = new ImageView (this.context);
			BackgroundImageView.Id = generateId ();
			AddView (BackgroundImageView);

			//Add an image that covers the entire signature view, used to display already drawn
			//elements instead of having to redraw them every time the user touches the screen.
			imageView = new ClearingImageView (context);
			imageView.SetBackgroundColor (Color.Transparent);
			imageView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
			AddView (imageView);

			lblSign = new TextView (context);
			lblSign.Id = generateId ();
			lblSign.SetIncludeFontPadding (true);
			lblSign.Text = "Sign Here";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.AlignWithParent = true;
			layout.BottomMargin = 6;
			layout.AddRule (LayoutRules.AlignBottom);
			layout.AddRule (LayoutRules.CenterHorizontal);
			lblSign.LayoutParameters = layout;
			lblSign.SetPadding (0, 0, 0, 6);
			AddView (lblSign);

			//Display the base line for the user to sign on.
			signatureLine = new View (context);
			signatureLine.Id = generateId ();
			signatureLine.SetBackgroundColor (Color.Gray);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, 1);
			layout.SetMargins (10, 0, 10, 5);
			layout.AddRule (LayoutRules.Above, lblSign.Id);
            signatureLine.LayoutParameters = layout;
			AddView (signatureLine);

			//Display the X on the left hand side of the line where the user signs.
			xLabel = new TextView (context);
			xLabel.Id = generateId ();
			xLabel.Text = "X";
			xLabel.SetTypeface (null, TypefaceStyle.Bold);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.LeftMargin = 11;
			layout.AddRule (LayoutRules.Above, signatureLine.Id);
			xLabel.LayoutParameters = layout;
			AddView (xLabel);

			AddView (canvasView);

			lblClear = new TextView (context);
			lblClear.Id = generateId ();
			lblClear.Text = "Clear";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.SetMargins (0, 10, 22, 0);
			layout.AlignWithParent = true;
			layout.AddRule (LayoutRules.AlignRight);
			layout.AddRule (LayoutRules.AlignTop);
			lblClear.LayoutParameters = layout;
			lblClear.Visibility = ViewStates.Invisible;
			lblClear.Click += (object sender, EventArgs e) => {
				Clear ();
			};
			AddView (lblClear);
			#endregion

			paths = new List<Path> ();
			points = new List<System.Drawing.PointF[]> ();
			currentPoints = new List<System.Drawing.PointF> ();

			dirtyRect = new RectF ();
		}
开发者ID:ronrat,项目名称:SignaturePad,代码行数:90,代码来源:SignaturePadView.cs


注:本文中的Android.Views.View.SetBackgroundColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。