/// <summary>关于事件的</summary> public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetOnClickListener(int viewId , Android.Views.View.IOnClickListener listener) { Android.Views.View view = GetView <View>(viewId); view.SetOnClickListener(listener); return(this); }
public ItemViewHolder(View view, Activity context) : base(view) { _itemView = view; view.Tag = this; _context = context; FavoriteName = _itemView.FindViewById<TextView>(Resource.Id.FavoriteItemName); FavoriteAdresse = _itemView.FindViewById<TextView>(Resource.Id.FavoriteItemAddress); _itemView.SetOnClickListener(new ItemClickListener(_context)); }
public void SetCustomClickableViewAndItem(int clickableViewId) { _clickableView = ItemView.FindViewById(clickableViewId); ItemView.SetOnClickListener(this); _clickableView.SetOnClickListener(this); if (_rotationEnabled) { _clickableView.Rotation = _rotation; } }
public Crouton(Activity activity, View customView, int durationInMs, Action<bool> onClick = null, object dataContext = null) { if (activity == null) throw new ArgumentNullException("activity"); if (customView == null) throw new ArgumentNullException("customView"); _activity = activity; _customView = customView; _onClick = onClick; customView.SetOnClickListener(this); DurationInMilliseconds = durationInMs; DataContext = dataContext; }
/** * 创建基本的背景视图 */ 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 static AppMsg MakeText(Activity context, String text, Style style, View view, bool floating, float textSize, View.IOnClickListener clickListener) { AppMsg result = new AppMsg(context); view.SetBackgroundResource(style.Background); view.Clickable = true; TextView tv = view.FindViewById<TextView>(Android.Resource.Id.Message); if (textSize > 0) { tv.SetTextSize(Android.Util.ComplexUnitType.Sp, textSize); } tv.Text = text; result.mView = view; result.mDuration = style.Duration; result.mFloating = floating; view.SetOnClickListener(clickListener); return result; }
/// <summary> /// Adds the view. /// </summary> /// <param name="child">The child.</param> /// <param name="index">The index.</param> /// <param name="params">The parameters.</param> public override void AddView(Android.Views.View child, int index, LayoutParams @params) { child.SetOnClickListener(this); base.AddView(child, index, @params); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); //Set the window fullscreen so that the background is drawn the correct size Window.AddFlags(WindowManagerFlags.KeepScreenOn); Window.AddFlags (WindowManagerFlags.Fullscreen); Window.AddFlags (WindowManagerFlags.LayoutNoLimits); // Set our view from the "main" layout resource SetContentView (Resource.Layout.activity_fullscreen); controlsView = FindViewById (Resource.Id.fullscreen_content_controls); contentView = FindViewById (Resource.Id.fullscreen_content); controller_view = (ControllerView)FindViewById (Resource.Id.controller); for (int i = 0; i < buttons.Length; i++) buttons [i] = 0; for (int i = 0; i < axes.Length; i++) axes [i] = 0.0f; controller_view.SetButtonAxes (buttons, axes); //Set up a UI hider to control the UI visibility for the activity system_ui_hider = SystemUiHider.GetInstance (this, contentView, HIDER_FLAGS); system_ui_hider.Setup (); system_ui_hider.SetOnVisibilityChangeListener (new MyOnVisibilityChangeListener (this)); contentView.SetOnClickListener (new MyOnClickListener (this)); input_manager = (InputManager)GetSystemService (Context.InputService); CheckGameControllers (); }
public void addItem(View item, IOnClickListener listener) { mArcLayout.AddView(item); item.SetOnClickListener(getItemClickListener(listener)); }
public RecyclerViewHolder(Android.Views.View itemView) : base(itemView) { ItemView = itemView; //ItemView.SetTag(1110010101, this); itemView.SetOnClickListener(this); }
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; }
public override void AddView(View child, int index, LayoutParams @params) { child.SetOnClickListener(this); base.AddView(child, index, @params); }
public MyView(View view) : base(view) { view.SetOnClickListener(this); }
protected override void OnFinishInflate () { mHandle = FindViewById( mHandleId ); if ( mHandle == null ) { throw new Java.Lang.IllegalArgumentException( "The handle attribute is must refer to an" + " existing child." ); } mHandle.SetOnClickListener ((IOnClickListener)new DrawerToggler (this)); // mHandle.Click += (sender, e) => { // if ( mLocked ) { return; } // // if ( mAnimateOnClick ) { // animateToggle(); // } else { // toggle(); // } // }; mContent = FindViewById( mContentId ); if ( mContent == null ) { throw new Java.Lang.IllegalArgumentException( "The content attribute is must refer to an" + " existing child." ); } mContent.Visibility = ViewStates.Gone ; }