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


C# Android类代码示例

本文整理汇总了C#中Android的典型用法代码示例。如果您正苦于以下问题:C# Android类的具体用法?C# Android怎么用?C# Android使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Init

        private void Init(Android.Content.Context context, IAttributeSet attrs, int p)
        {
            TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircleProgressBar, p, 0);
            float density = context.Resources.DisplayMetrics.Density;

            mBackGroundColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT);
            mProgressColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT);
            mInnerRadius = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_inner_radius, -1);
            mProgressStokeWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_stoke_width, (int)(STROKE_WIDTH_LARGE * density));
            mArrowWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_width, -1);
            mArrowHeight = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_height, -1);
            mTextSize = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_text_size, (int)(DEFAULT_TEXT_SIZE * density));
            mTextColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_text_color, Color.Black);
            mShowArrow = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_show_arrow, false);
            mCircleBackgroundEnabled = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_enable_circle_background, true);

            mProgress = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress, 0);
            mMax = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_max, 100);
            int textVisible = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress_text_visibility, 1);
            if (textVisible != 1)
            {
                mIfDrawText = true;
            }

            mTextPaint = new Paint();
            mTextPaint.SetStyle(Paint.Style.Fill);
            mTextPaint.Color = mTextColor;
            mTextPaint.TextSize = mTextSize;
            mTextPaint.AntiAlias = true;
            a.Recycle();
            mProgressDrawable = new MaterialProgressDrawale(Context, this);
            base.SetImageDrawable(mProgressDrawable);
        }
开发者ID:devxiaruwei,项目名称:MaterialProgressbar,代码行数:33,代码来源:CircleProgressBar.cs

示例2: Application

		public Application (IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip)
			:
			base (handle, ownerShip)
		{

			return;
		}
开发者ID:moljac,项目名称:Ph4ct3x,代码行数:7,代码来源:Application.cs

示例3: OnError

        public bool OnError(MediaPlayer mp, Android.Media.MediaError e, int s)
        {
#if DEBUG
            Console.WriteLine("{0}", e.ToString());
#endif
            return true;
        }
开发者ID:nodoid,项目名称:Webview,代码行数:7,代码来源:videoplayer.cs

示例4: OnClick

 public override void OnClick(Android.App.Fragment source, int buttonId, object context = null)
 {
     // only handle input if the springboard is closed
     if ( NavbarFragment.ShouldTaskAllowInput( ) )
     {
         // if the main page is the source
         if ( source == MainPage )
         {
             // and it's button id 0, goto the create page
             if ( buttonId == 0 )
             {
                 PresentFragment( CreatePage, true );
             }
         }
         else if ( source == CreatePage )
         {
             if ( buttonId == 0 )
             {
                 PostPage.PrayerRequest = (Rock.Client.PrayerRequest)context;
                 PresentFragment( PostPage, true );
             }
         }
         else if ( source == PostPage )
         {
             // this is our first / only "circular" navigation, as we're returning to the main page after 
             // having posted a prayer. In which case, clear the back stack.
             NavbarFragment.FragmentManager.PopBackStack( null, PopBackStackFlags.Inclusive );
             PresentFragment( MainPage, false );
         }
     }
 }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:31,代码来源:PrayerTask.cs

示例5: TransformPage

		/// <summary>
		/// Transforms the page.
		/// </summary>
		/// <param name="page">The page.</param>
		/// <param name="position">The position.</param>
		public void TransformPage(Android.Views.View page, float position)
		{
			int pageWidth = page.Width;
			if(position < -1)
			{
				page.Alpha = 0;
			} else if(position <= 0)
			{
				page.Alpha = (1);
				page.TranslationX = 0;
				page.ScaleX = 1;
				page.ScaleY = 1;
			} else if(position <= 1)
			{
				page.Alpha = 1 - position;
				page.TranslationX = (pageWidth * -position);
				float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.Abs(position));
				page.ScaleX = (scaleFactor);
				page.ScaleY = (scaleFactor);


			} else
			{
				page.Alpha = 0;
			}

		}
开发者ID:Jaskomal,项目名称:Xamarin-Forms-Labs,代码行数:32,代码来源:CalendarMonthPageTransformer.cs

示例6: OnAnimationEnd

 public void OnAnimationEnd(Android.Views.Animations.Animation animation)
 {
     if (m_isLast && OnAnimationEndEvent != null)
     {
         OnAnimationEndEvent();
     }
 }
开发者ID:veresbogdan,项目名称:MMD,代码行数:7,代码来源:AnimationListener.cs

示例7: OnCreateViewHolder

        public override RecyclerView.ViewHolder OnCreateViewHolder(Android.Views.ViewGroup parent, int viewType)
        {
            TextView tv = (TextView)LayoutInflater.From(parent.Context).
                Inflate(Android.Resource.Layout.SimpleListItem1, parent, false);

            return new ViewHolder(tv);
        }
开发者ID:akamud,项目名称:FloatingActionButton-Xamarin.Android,代码行数:7,代码来源:LanguageAdapter.cs

示例8: OnConfigurationChanged

                public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
                {
                    base.OnConfigurationChanged(newConfig);

                    ResultView.SetBounds( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );
                    BlockerView.SetBounds( new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) );
                }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:7,代码来源:PrayerPostFragment.cs

示例9: OnServiceConnected

        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Logger.Debug ("Billing service connected.");
            Service = IInAppBillingServiceStub.AsInterface (service);

            string packageName = _activity.PackageName;

            try {
                Logger.Debug ("Checking for in-app billing V3 support");

                int response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.InApp);
                if (response != BillingResult.OK) {
                    Connected = false;
                }

                Logger.Debug ("In-app billing version 3 supported for {0}", packageName);

                // check for v3 subscriptions support
                response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK) {
                    Logger.Debug ("Subscriptions AVAILABLE.");
                    Connected = true;
                    RaiseOnConnected (Connected);

                    return;
                } else {
                    Logger.Debug ("Subscriptions NOT AVAILABLE. Response: {0}", response);
                    Connected = false;
                }

            } catch (Exception ex) {
                Logger.Debug (ex.ToString ());
                Connected = false;
            }
        }
开发者ID:camradal,项目名称:TodayILearned,代码行数:35,代码来源:InAppBillingServiceConnection.cs

示例10: OnDraw

        protected override void OnDraw(Android.Graphics.Canvas canvas)
        {
            base.OnDraw (canvas);

            TextPaint textPaint = Paint;
            textPaint.Color = new Android.Graphics.Color(CurrentTextColor);
            textPaint.DrawableState = GetDrawableState ();

            canvas.Save();

            if ( TopDown )
            {
                canvas.Translate( Width, 0 );
                canvas.Rotate( 90 );
            }
            else
            {
                canvas.Translate( 0, Height );
                canvas.Rotate( -90 );
            }

            canvas.Translate (CompoundPaddingLeft, ExtendedPaddingTop);

            Layout.Draw (canvas);
            //			getLayout().draw( canvas );
            canvas.Restore ();
            //			canvas.restore();
        }
开发者ID:pafik13,项目名称:pharm-merch-tablet,代码行数:28,代码来源:VerticalTextView.cs

示例11: OnAutoFocus

 public void OnAutoFocus(bool focused, Android.Hardware.Camera camera)
 {
     if (focused)
     {
         Toast.MakeText(context, Application.Context.Resources.GetString(Resource.String.commonFocused), ToastLength.Short).Show();
     }
 }
开发者ID:nodoid,项目名称:Camera,代码行数:7,代码来源:CameraTakePictureActivity.cs

示例12: Execute

 public override Android.Content.Intent Execute(Android.Content.Context context)
 {
     String[] titles = new String[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" };
     IList<double[]> x = new List<double[]>();
     IList<double[]> values = new List<double[]>();
     int count = 20;
     int length = titles.Length;
     Random r = new Random();
     for (int i = 0; i < length; i++)
     {
         double[] xValues = new double[count];
         double[] yValues = new double[count];
         for (int k = 0; k < count; k++)
         {
             xValues[k] = k + r.Next() % 10;
             yValues[k] = k * 2 + r.Next() % 10;
         }
         x.Add(xValues);
         values.Add(yValues);
     }
     int[] colors = new int[] { Color.Blue, Color.Cyan, Color.Magenta, Color.LightGray, Color.Green };
     PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.Diamond, PointStyle.Triangle, PointStyle.Square, PointStyle.Circle };
     XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles);
     SetChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.Gray, Color.LightGray);
     renderer.XLabels = 10;
     renderer.YLabels = 10;
     length = renderer.SeriesRendererCount;
     for (int i = 0; i < length; i++)
     {
         ((XYSeriesRenderer)renderer.GetSeriesRendererAt(i)).FillPoints = true;
     }
     return ChartFactory.GetScatterChartIntent(context, BuildDataset(titles, x, values), renderer);
 }
开发者ID:huguodong,项目名称:AChartEngine-Xamarin,代码行数:33,代码来源:ScatterChart.cs

示例13: OnServiceConnected

        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Service = IInAppBillingServiceStub.AsInterface (service);

            string packageName = _activity.PackageName;

            try {

                int response = Service.IsBillingSupported (Xamarin.InAppBilling.Billing.APIVersion, packageName, "inapp");
                if (response != BillingResult.OK) {
                    Connected = false;
                }

                // check for v3 subscriptions support
                response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK) {

                    Connected = true;
                    RaiseOnConnected (Connected);

                    return;
                } else {

                    Connected = false;
                }

            } catch (Exception ex) {

                Connected = false;
            }
        }
开发者ID:shakor,项目名称:XamarinInAppBillingForCafeBazaar,代码行数:31,代码来源:InAppBillingServiceConnection.cs

示例14: OnCreateView

        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view = this.BindingInflate(Resource.Layout.fragment_friends, null);

            // Create your application here
            this.m_ViewPager = view.FindViewById<ViewPager>(Resource.Id.viewPager);
            this.m_ViewPager.OffscreenPageLimit = 4;
            this.m_PageIndicator = view.FindViewById<TabPageIndicator>(Resource.Id.viewPagerIndicator);


            var fragments = new List<MvxViewPagerFragmentAdapter.FragmentInfo>
              {
                new MvxViewPagerFragmentAdapter.FragmentInfo
                {
                  FragmentType = typeof(FriendsAllView),
                  Title = "All",
                  ViewModel = this.ViewModel.FriendsAllViewModel
                },
                new MvxViewPagerFragmentAdapter.FragmentInfo
                {
                  FragmentType = typeof(FriendsRecentView),
                  Title = "Recent",
                  ViewModel = this.ViewModel.FriendsRecentViewModel
                }
              };


            this.m_Adapter = new MvxViewPagerFragmentAdapter(this.Activity, this.ChildFragmentManager, fragments);
            this.m_ViewPager.Adapter = this.m_Adapter;

            this.m_PageIndicator.SetViewPager(this.m_ViewPager);
            this.m_PageIndicator.CurrentItem = 0;
            return view;
        }
开发者ID:MilenPavlov,项目名称:Xam.NavDrawer,代码行数:35,代码来源:FriendsView.cs

示例15: OnStart

		public override void OnStart (Android.Content.Intent intent, int startId)
		{
			base.OnStart (intent, startId);
			serviceStarted = true;
			Log.Debug ("InvitePollService", "SimpleService started");
			DoStuff ();
		}
开发者ID:sourcefile,项目名称:OrdinaCompetitie,代码行数:7,代码来源:InvitePollService.cs


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