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


C# Button.SetOnClickListener方法代码示例

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


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

示例1: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ViewGroup layoutRoot = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_dataform_features, null);

            CheckBox readOnly = (CheckBox)layoutRoot.FindViewById(Resource.Id.readOnly);
            readOnly.SetOnCheckedChangeListener(this);

            dataForm = Android.Runtime.Extensions.JavaCast<RadDataForm>(layoutRoot.FindViewById(Resource.Id.dataForm));

            person = new Person();
            person.AddPropertyChangedListener(this);

            dataForm.SetEntity (person);

            RangeValidator validator = (RangeValidator) dataForm.GetExistingEditorForProperty("Age").Property().Validator;
            validator.Max = 30;
            validator.Min = 18;

            Spinner commitModes = (Spinner)layoutRoot.FindViewById(Resource.Id.commitModeSpinner);
            commitModes.Adapter = new ArrayAdapter(this.Activity, Android.Resource.Layout.SimpleSpinnerItem, CommitMode.Values());
            commitModes.OnItemSelectedListener = this;

            personText = (TextView)layoutRoot.FindViewById(Resource.Id.personText);

            commitButton = (Button) layoutRoot.FindViewById(Resource.Id.manualCommit);
            commitButton.SetOnClickListener(this);

            return layoutRoot;
        }
开发者ID:antiifreedom,项目名称:Android-samples,代码行数:29,代码来源:DataFormFeaturesFragment.cs

示例2: OnCreate

		protected override void OnCreate (Bundle savedInstanceState)
		{
			TapjoyLog.EnableLogging (true);

			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.activity_features);

			debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field_features);

			// Set up API button click listeners
			offers = (Button)FindViewById (Resource.Id.OffersButton);
			offers.SetOnClickListener (this);

			events = (Button)FindViewById (Resource.Id.EventsButton);
			events.SetOnClickListener (this);

			getDirectPlayVideoAd = (Button)FindViewById (Resource.Id.GetDirectPlayVideoAd);
			getDirectPlayVideoAd.SetOnClickListener (this);

			vc = (Button)FindViewById (Resource.Id.VirtualCurrencyButton);
			vc.SetOnClickListener (this);
			if (!isAppManaged ()) {
				vc.Visibility = ViewStates.Gone;
			}
		}
开发者ID:shaxxx,项目名称:Xamarin.Tapjoy,代码行数:26,代码来源:FeaturesActivity.cs

示例3: SelectPicPopWindow

		public SelectPicPopWindow (Activity _activity,View.IOnClickListener listener)
		{
			activity = _activity;
			LayoutInflater inflater = (LayoutInflater) activity.GetSystemService (Context.LayoutInflaterService);
			contentView = inflater.Inflate(Resource.Layout.headImgSelectorPop, null);  
			ContentView = contentView;
			btn_take_photo = contentView.FindViewById<Button> (Resource.Id.btn_take_photo);
			btn_pick_photo = contentView.FindViewById<Button> (Resource.Id.btn_pick_photo);
			btn_cancel = contentView.FindViewById<Button> (Resource.Id.btn_pic_cancel);
			//设置宽度、高度
			Width = Android.Views.ViewGroup.LayoutParams.MatchParent;
			Height = Android.Views.ViewGroup.LayoutParams.WrapContent;
			Focusable = true;
			OutsideTouchable = true;
			SetBackgroundDrawable (new ColorDrawable());
			AnimationStyle = Resource.Style.Animationbottom;

			//设置按钮绑定
			btn_take_photo.SetOnClickListener (listener);
			btn_pick_photo.SetOnClickListener (listener);

			//取消
			btn_cancel.Click += (sender, e) => 
			{
				Dismiss();

			};

			DismissEvent+= (sender, e) => 
			{
				BackgroundAlpha(1f);
			};

		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:34,代码来源:SelectPicPopWindow.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SupportActionBar.Hide();
            SetContentView(Resource.Layout.Login);
            loginViewModel = new LoginViewModel();
            ServiceLocator.Dispatcher = new DispatchAdapter(this);
            loginField = FindViewById<EditText>(Resource.Id.username);
            passwordField = FindViewById<EditText>(Resource.Id.password);
            submit = FindViewById<Button>(Resource.Id.submit);
            submit.SetOnClickListener(this);

            ServiceLocator.Messenger.Subscribe<BaseViewMessage>(m => 
            {
                switch (m.Content.message) 
                {
                    case BaseViewMessage.MessageTypes.CONNECTION_ERROR:
                        Toast.MakeText(this, "Erro de conexão", ToastLength.Short).Show();
                        break;
                    case BaseViewMessage.MessageTypes.LOGIN_CONNECTION_OK:
                        getCourses();
                        break;
                    case BaseViewMessage.MessageTypes.COURSE_CONNECTION_OK:
                        intent = new Intent(this, typeof(CoursesActivity));
                        intent.SetFlags(ActivityFlags.ClearTop);
                        StartActivity(intent);
                        break;
                    default:
                        break;
                }            
            });
        }
开发者ID:paulombcosta,项目名称:mono-mobilis,代码行数:32,代码来源:LoginActivity.cs

示例5: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ViewGroup rootLayout = (ViewGroup) inflater.Inflate(Resource.Layout.fragment_dataform_validation_mode, null);

            Spinner validationModeSpinner = (Spinner) rootLayout.FindViewById(Resource.Id.data_form_validation_mode_spinner);
            validationModeSpinner.OnItemSelectedListener = this;
            validationModeSpinner.Adapter = new ArrayAdapter(this.Activity, Android.Resource.Layout.SimpleSpinnerItem, new ValidationMode[]{ValidationMode.Immediate, ValidationMode.OnLostFocus, ValidationMode.Manual});

            dataForm = new RadDataForm(this.Activity);

            dataForm.LayoutManager = new DataFormLinearLayoutManager(this.Activity);
            dataForm.CommitMode = CommitMode.Manual;
            dataForm.ValidationMode = ValidationMode.Immediate;

            Person joe = new Person();
            joe.Name = "Joe";
            joe.Mail = "[email protected]";
            dataForm.SetEntity (joe);

            validateButton = (Button)rootLayout.FindViewById(Resource.Id.data_form_validate_button);
            validateButton.SetOnClickListener(this);

            rootLayout.AddView(dataForm, 0);

            return rootLayout;
        }
开发者ID:bmccool,项目名称:Android-samples,代码行数:26,代码来源:DataFormValidationModeFragment.cs

示例6: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ViewGroup layoutRoot = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_dataform_features, null);

            CheckBox readOnly = (CheckBox)layoutRoot.FindViewById(Resource.Id.readOnly);
            readOnly.SetOnCheckedChangeListener(this);

            dataForm = Android.Runtime.Extensions.JavaCast<RadDataForm>(layoutRoot.FindViewById(Resource.Id.dataForm));
            dataForm.LayoutManager = new DataFormLinearLayoutManager (this.Activity);

            person = new Person();
            person.AddPropertyChangedListener(this);

            dataForm.Entity = new XamarinEntity(person);

            DataFormSpinnerEditor editor = Android.Runtime.Extensions.JavaCast<DataFormSpinnerEditor> (dataForm.GetExistingEditorForProperty("EmployeeType"));
            editor.Adapter = new Com.Telerik.Widget.Dataform.Visualization.Editors.Adapters.EditorSpinnerAdapter (this.Activity, new Java.Lang.Object[] { "PROGRAMMER", "MANAGER", "SUPPORT", "MARKETING" });

            RangeValidator validator = (RangeValidator) dataForm.GetExistingEditorForProperty("Age").Property().Validator;
            validator.Max = 30;
            validator.Min = 18;

            Spinner commitModes = (Spinner)layoutRoot.FindViewById(Resource.Id.commitModeSpinner);
            commitModes.Adapter = new ArrayAdapter(this.Activity, Android.Resource.Layout.SimpleSpinnerItem, CommitMode.Values());
            commitModes.OnItemSelectedListener = this;

            personText = (TextView)layoutRoot.FindViewById(Resource.Id.personText);

            commitButton = (Button) layoutRoot.FindViewById(Resource.Id.manualCommit);
            commitButton.SetOnClickListener(this);

            return layoutRoot;
        }
开发者ID:rafasame,项目名称:Android-samples,代码行数:33,代码来源:DataFormFeaturesFragment.cs

示例7: InitTabBtnView

		private void InitTabBtnView( ) {
			tab_btn_writeAdvice = FindViewById<Button>(Resource.Id.tab_btn_writeAdvice);
			tab_btn_recordAdvice = FindViewById<Button>(Resource.Id.tab_btn_recordAdvice);
			tab_btn_writeAdvice.SetTextColor(Resources.GetColor(Resource.Color.blue));

			tab_btn_writeAdvice.SetOnClickListener(this);
			tab_btn_recordAdvice.SetOnClickListener(this);
		}
开发者ID:lq-ever,项目名称:EldYoungAndroidApp,代码行数:8,代码来源:AdviceActivity.cs

示例8: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			texture_view = (AutoFitTextureView)view.FindViewById (Resource.Id.texture);
			texture_view.SurfaceTextureListener = surface_texture_listener;
			button_video = (Button)view.FindViewById (Resource.Id.video);
			button_video.SetOnClickListener (this);
			view.FindViewById (Resource.Id.info).SetOnClickListener (this);

		}
开发者ID:haoxianliang417,项目名称:monodroid-samples,代码行数:9,代码来源:Camera2VideoFragment.cs

示例9: Init

			public void Init (Activity activity, Button playButton)
			{
				// This called by the containing activity to supply the surrounding
				// state of the game that it will interact with.
				mPlayButton = playButton;
				mPlayButton.SetOnClickListener (this);
				SetGamePaused (true);

				mFader = () => Run ();
			}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:10,代码来源:GameActivity.cs

示例10: OnCreate

 override protected void OnCreate(Bundle savedInstanceState)
 {
    base.OnCreate(savedInstanceState);
    SetContentView(R.Layouts.share_activity);
    mSendButton = (Button)FindViewById(R.Ids.send_interactive_button);
    mSendButton.SetOnClickListener(this);
    mSendButton.SetEnabled(true);
    mEditSendText = (EditText)FindViewById(R.Ids.share_prefill_edit);
    mPlusClientFragment =
            PlusClientFragment.GetPlusClientFragment(this, MomentUtil.VISIBLE_ACTIVITIES);
    mSharing =
            savedInstanceState != null && savedInstanceState.GetBoolean(STATE_SHARING, false);
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:13,代码来源:ShareActivity.cs

示例11: OnCreate

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

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

            _scrollView = FindViewById<ParallaxScrollView>(Resource.Id.scroll_view);
            _factorText = FindViewById<TextView>(Resource.Id.factor_text);
            _minus = FindViewById<Button>(Resource.Id.minus);
            _minus.SetOnClickListener(this);
            _plus = FindViewById<Button>(Resource.Id.plus);
            _plus.SetOnClickListener(this);
        }
开发者ID:jorik041,项目名称:ParallaxScrollView,代码行数:14,代码来源:Activity1.cs

示例12: CustomEditor

			public CustomEditor(RadDataForm dataForm, IEntityProperty property) : base(dataForm,
					dataForm.EditorsMainLayout,
					dataForm.EditorsHeaderLayout,
					Resource.Id.data_form_text_viewer_header,
					Resource.Layout.dataform_custom_editor,
					Resource.Id.custom_editor,
					dataForm.EditorsValidationLayout,
					property)
			{

				editorButton = (Button)EditorView;
				editorButton.SetOnClickListener(this);

				((TextView)HeaderView).Text = property.Header;

			}
开发者ID:bmccool,项目名称:Android-samples,代码行数:16,代码来源:DataFormEditorsFragment.cs

示例13: OnCreate

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

			mAdView = FindViewById<AdView> (Resource.Id.adView);
			var adRequest = new AdRequest.Builder ().Build ();
			mAdView.LoadAd (adRequest);

			mInterstitialAd = new InterstitialAd (this);
			mInterstitialAd.AdUnitId = GetString (Resource.String.test_interstitial_ad_unit_id);

			mInterstitialAd.AdListener = new AdListener (this);

			mLoadInterstitialButton = FindViewById<Button> (Resource.Id.load_interstitial_button);
			mLoadInterstitialButton.SetOnClickListener (new OnClickListener (this));
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:17,代码来源:MainActivity.cs

示例14: OnCreate

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

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

            //var viewGroup = ((ViewGroup)FindViewById<TextView> (Resource.Id.InstructionStep1).Parent);
            //viewGroup.SetOnTouchListener(new OnSwipeListener(this));
            _viewFlipper = FindViewById<ViewFlipper>(Resource.Id.ViewFlipper);

            // Button
            _button = FindViewById<Button>(Resource.Id.button1);
            _button.SetOnClickListener(this);

            var onSwipeListener = new OnSwipeListener (_viewFlipper, this);
            FindViewById(Resource.Id.step1View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step2View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step3View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step4View).SetOnTouchListener (onSwipeListener);
        }
开发者ID:TelethonKidsSunExposure,项目名称:SunExposureApp,代码行数:21,代码来源:MainActivity.cs

示例15: init

		private void init() {

			var prefs = PreferenceManager.GetDefaultSharedPreferences (this);
			//TODO : change the 1 as like in native app
			int initialColor = prefs.GetInt ("color_3", 1);//Convert.ToInt32("4278190080"));

			mColorPickerView = (ColorPickerView) FindViewById(Resource.Id.color_picker_view);
			mOldColorPanelView = (ColorPanelView) FindViewById(Resource.Id.color_panel_old);
			mNewColorPanelView = (ColorPanelView) FindViewById(Resource.Id.color_panel_new);

			mOkButton = (Button) FindViewById(Resource.Id.okButton);
			mCancelButton = (Button) FindViewById(Resource.Id.cancelButton);

			((LinearLayout) mOldColorPanelView.Parent).SetPadding(
				(int)Math.Round(mColorPickerView.getDrawingOffset()), 
				0, 
				(int)Math.Round(mColorPickerView.getDrawingOffset()), 
				0);
			 

			mColorPickerView.setOnColorChangedListener(this);
			mColorPickerView.setColor(initialColor, true);
			mOldColorPanelView.setColor(initialColor);

			mOkButton.SetOnClickListener(this);
			mCancelButton.SetOnClickListener(this);

			mOkButton.Click += (sender, e) => {
				var edit = PreferenceManager.GetDefaultSharedPreferences(this).Edit();
				edit.PutInt("color_3", mColorPickerView.getColor());
				edit.Commit();

				Finish();	
			};
			mCancelButton.Click += (sender, e) => {
				Finish();
			};

		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:39,代码来源:ColorPickerActivity.cs


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