本文整理汇总了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);
}
示例2: Application
public Application (IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip)
:
base (handle, ownerShip)
{
return;
}
示例3: OnError
public bool OnError(MediaPlayer mp, Android.Media.MediaError e, int s)
{
#if DEBUG
Console.WriteLine("{0}", e.ToString());
#endif
return true;
}
示例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 );
}
}
}
示例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;
}
}
示例6: OnAnimationEnd
public void OnAnimationEnd(Android.Views.Animations.Animation animation)
{
if (m_isLast && OnAnimationEndEvent != null)
{
OnAnimationEndEvent();
}
}
示例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);
}
示例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 ) );
}
示例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;
}
}
示例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();
}
示例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();
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例15: OnStart
public override void OnStart (Android.Content.Intent intent, int startId)
{
base.OnStart (intent, startId);
serviceStarted = true;
Log.Debug ("InvitePollService", "SimpleService started");
DoStuff ();
}