• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Android类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Init

 /// <summary>
 /// Initialize android user dialogs
 /// </summary>
 public static void Init(Android.App.Activity activity, bool useAppCompat = false) {
     ActivityLifecycleCallbacks.Register(activity);
     if (useAppCompat)
         Instance = new AppCompatUserDialogsImpl(null);
     else
         Instance = new UserDialogsImpl(null);
 }
开发者ID:benoitjadinon,项目名称:userdialogs,代码行数:10,代码来源:UserDialogs.cs


示例17: OnCreate

        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            //RequestWindowFeature(Android.Views.WindowFeatures.ActionBar);
            base.OnCreate(savedInstanceState);
            CrimePagerActivity.context = this;
            mViewPager = new ViewPager(this);
            mViewPager.Id = (Resource.Id.viewPager);
            SetContentView(mViewPager);

            mCrimes = CrimeLab.GetInstance(CrimePagerActivity.context).Crimes;

            Title = mCrimes[0].Title;
            CrimePagerAdapter adapter = new CrimePagerAdapter(SupportFragmentManager);
            mViewPager.Adapter = adapter;
            mViewPager.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) => {
                var crime = mCrimes[e.Position];
                if (crime.Title != null)
                    Title = crime.Title;
            };

            //			mViewPager.SetOnPageChangeListener(this);

            string crimeId = Intent.GetStringExtra(CrimeFragment.EXTRA_CRIME_ID);
            for (int i = 0; i < mCrimes.Count; i++) {
                if (mCrimes[i].Id == crimeId) {
                    mViewPager.SetCurrentItem(i, false);
                    break;
                }
            }
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:30,代码来源:CrimePagerActivity.cs


示例18: Setup

 private void Setup(Android.Content.Context context)
 {
     AndroidContext = context;
     TextureLoader._context = context;
     RequestFocus();
     FocusableInTouchMode = true;
 }
开发者ID:fmotagarcia,项目名称:sparrow-sharp,代码行数:7,代码来源:AndroidViewController.cs


示例19: OnCreateOptionsMenu

 // Menu aanmaken met de drie schermen voor navigatie binnen de applicatie
 public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
 {
     base.OnCreateOptionsMenu(menu);
     int groupId = 0;
     int menuItemId = Android.Views.Menu.First;
     int menuItemOrder = Android.Views.Menu.None;
     // Text to be displayed for this menu item.
     int menuItemText = Resource.String.menuitem1;
     // Create the menu item and keep a reference to it.
     //Het eerste menu item wordt hier toegevoegd
     IMenuItem menuItem1 = menu.Add(groupId, menuItemId, menuItemOrder, menuItemText);
     menuItem1.SetShortcut('1', 'a');
     Int32 MenuGroup = 10;
     //Het tweede menu item wordt hier toegevoegd
     IMenuItem menuItem2 =
         menu.Add(MenuGroup, menuItemId + 1, menuItemOrder + 1,
             new Java.Lang.String("Toevoegen"));
     menuItem2.SetShortcut('2', 'b');
     //Het derde menu item wordt hier toegevoegd
     IMenuItem menuItem3 =
         menu.Add(MenuGroup, menuItemId + 2, menuItemOrder + 2,
             new Java.Lang.String("Overzicht"));
     menuItem3.SetShortcut('3', 'c');
     return true;
 }
开发者ID:Kabouterhuisje,项目名称:Android_Concert2Go,代码行数:26,代码来源:MainActivity.cs


示例20: OnCreateView

        public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {            
            var view = inflater.Inflate (Resource.Layout.fragment_cart_detail, container, false);

            var itemInfo = Constants.ITEMS_FOR_SALE[mItemId];

            var itemName = view.FindViewById<TextView> (Resource.Id.text_item_name);
            itemName.Text = itemInfo.Name;

            var itemImage = Resources.GetDrawable (itemInfo.ImageResourceId);
            int imageSize = Resources.GetDimensionPixelSize (Resource.Dimension.image_thumbnail_size);
            int actualWidth = itemImage.IntrinsicWidth;
            int actualHeight = itemImage.IntrinsicHeight;
            int scaledHeight = imageSize;
            int scaledWidth = (int) (((float) actualWidth / actualHeight) * scaledHeight);
            itemImage.SetBounds (0, 0, scaledWidth, scaledHeight);
            itemName.SetCompoundDrawables (itemImage, null, null, null);

            var itemPrice = view.FindViewById<TextView> (Resource.Id.text_item_price);
            itemPrice.Text = Util.FormatPrice (Activity, itemInfo.PriceMicros);
            var shippingCost = view.FindViewById<TextView> (Resource.Id.text_shipping_price);
            var tax = view.FindViewById<TextView> (Resource.Id.text_tax_price);
            var total = view.FindViewById<TextView> (Resource.Id.text_total_price);
            if ((mItemId == Constants.PROMOTION_ITEM) && ((BikestoreApplication)this.Activity.Application).IsAddressValidForPromo) {
                shippingCost.Text = Util.FormatPrice (Activity, 0L);
            } else {
                shippingCost.Text = Util.FormatPrice (Activity, itemInfo.ShippingPriceMicros);
            }

            tax.Text = Util.FormatPrice (Activity, itemInfo.TaxMicros);
            total.Text = Util.FormatPrice (Activity, itemInfo.TotalPrice);

            return view;
        }
开发者ID:apcurium,项目名称:xamarin-bindings,代码行数:34,代码来源:CartDetailFragment.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Net.Uri类代码示例发布时间:2022-05-24
下一篇:
C# AnchorType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap