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


C# View.SetLayerType方法代码示例

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


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

示例1: OnTouch

        public Boolean OnTouch(View v, MotionEvent ev)
        {
            if (_box != null)
            {
                v.SetLayerType(LayerType.Software, null);
                switch (ev.Action)
                {
                    case MotionEventActions.Down:
                        if (_touchState != TouchState.Result)
                        {
                            _touchState = TouchState.None;
                        }
                        int x = (int)ev.GetX();
                        int y = (int)ev.GetY();
                        Android.Graphics.Point cursor = new Android.Graphics.Point(x, y);
                        Android.Graphics.Point leftBot = new Android.Graphics.Point((int)(_box.MidX - _box.Width / 2), (int)(_box.MidY + _box.Height / 2));
                        Android.Graphics.Point rightBot = new Android.Graphics.Point((int)(_box.MidX + _box.Width / 2), (int)(_box.MidY + _box.Height / 2));
                        Android.Graphics.Point rightTop = new Android.Graphics.Point((int)(_box.MidX + _box.Width / 2), (int)(_box.MidY - _box.Height / 2));
                        double botLine = BitmapHelpers.LineToCursorDistance(cursor, leftBot, rightBot);
                        double rightLine = BitmapHelpers.LineToCursorDistance(cursor, rightTop, rightBot);
                        //Choose an binarized image and start OCR
                        if (_touchState == TouchState.Result)
                        {
							if (x <= screenWidth / 2 && y <= screenHeight / 3)
                            {
                                threshhold = threshholds[0];
                            }
							else if (x > screenWidth / 2 && y <= screenHeight / 3)
                            {
                                threshhold = threshholds[1];
                            }
							else if (x <= screenWidth / 2 && y <= screenHeight * 2 / 3)
                            {
                                threshhold = threshholds[2];
                            }
							else if (x > screenWidth / 2 && y <= screenHeight * 2 / 3)
                            {
                                threshhold = threshholds[3];
                            }
							else if (x <= screenWidth / 2 && y <= screenHeight)
                            {
                                threshhold = threshholds[4];
                            }
							else if (x > screenWidth / 2 && y <= screenHeight)
                            {
                                threshhold = threshholds[5];
                            }
                            _surfaceBox.SetOnTouchListener(null);
                            if (!_processDialog.IsShowing)
                            {
                                _processDialog.SetMessage("Waiting for character recognition...");
                                _processDialog.Show();
                            }
                            PerformResult();
                        }
                        //Move box over camera
                        else if (botLine <= lineDistance && rightLine <= lineDistance)
                        {
                            _touchState = TouchState.Mixed;
                        }
                        else if (botLine <= lineDistance)
                        {
                            _touchState = TouchState.Horizontal;
                        }
                        else if (rightLine <= lineDistance)
                        {
                            _touchState = TouchState.Vertical;
                        }
                        else if (x >= _box.MidX - _box.Width / 2 && x <= _box.MidX + _box.Width / 2 && y >= _box.MidY - _box.Height / 2 && y <= _box.MidY + _box.Height / 2)
                        {
                            _touchState = TouchState.Moving;
                        }
                        touchStartX = x;
                        touchStartY = y;
                        break;
                    case MotionEventActions.Move:
                        if (_touchState == TouchState.Moving)
                        {
                            _box.MidX += ev.GetX() - touchStartX;
                            _box.MidY += ev.GetY() - touchStartY;
                        }
                        else if (_touchState == TouchState.Horizontal)
                        {
                            _box.Height += ev.GetY() - touchStartY;
                        }
                        else if (_touchState == TouchState.Vertical)
                        {
                            _box.Width += ev.GetX() - touchStartX;
                        }
                        else if (_touchState == TouchState.Mixed)
                        {
                            _box.Width += ev.GetX() - touchStartX;
                            _box.Height += ev.GetY() - touchStartY;
                        }
                        touchStartX = ev.GetX();
                        touchStartY = ev.GetY();
                        break;
                    case MotionEventActions.Up:
                        if (_touchState == TouchState.Moving)
                        {
//.........这里部分代码省略.........
开发者ID:SansSkill,项目名称:Introproject,代码行数:101,代码来源:CameraActivity.cs

示例2: setLayerType

		public static void setLayerType(View view, int layerType) {
			view.SetLayerType((LayerType)layerType, null);
            
		}
开发者ID:skywolf888,项目名称:Android-PullToRefresh.Net,代码行数:4,代码来源:ViewCompat.cs

示例3: ManageLayer

        private void ManageLayer(View v, bool enableHardware)
        {
            if (!IsHoneycomb)
            {
                return;
            }

            var layerType = enableHardware ? LayerType.Hardware : LayerType.None;
            if (layerType != v.LayerType)
            {
                v.SetLayerType(layerType, null);
            }
        }
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:13,代码来源:JazzyViewPager.cs


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