protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var display = WindowManager.DefaultDisplay; var horiPager = new HorizontalPager(this.ApplicationContext, display); horiPager.ScreenChanged += new ScreenChangedEventHandler(horiPager_ScreenChanged); //You can also use: /*horiPager.ScreenChanged += (sender, e) => { System.Diagnostics.Debug.WriteLine("Switched to screen: " + ((HorizontalPager)sender).CurrentScreen); };*/ var backgroundColors = new Color[] { Color.Red, Color.Blue, Color.Cyan, Color.Green, Color.Yellow }; for (int i = 0; i < 5; i++) { var textView = new TextView(this.ApplicationContext); textView.Text = (i + 1).ToString(); textView.TextSize = 100; textView.SetTextColor(Color.Black); textView.Gravity = GravityFlags.Center; textView.SetBackgroundColor(backgroundColors[i]); horiPager.AddView(textView); } SetContentView(horiPager); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var mLayout = new FrameLayout(this); surface = UrhoSurface.CreateSurface(this, typeof(MySample)); //surface.Background.SetAlpha(10); TextView txtView = new TextView(this); txtView.SetBackgroundColor(Color.Violet); txtView.SetWidth(10); txtView.SetHeight(10); txtView.Text = "HAHAH"; //txtView.Text = surface.Background.ToString(); Button btn = new Button(this); btn.SetBackgroundColor(Color.Transparent); btn.Text = "Button"; btn.SetHeight(100); btn.SetWidth(100); btn.SetX(30); btn.SetY(30); btn.TextAlignment = TextAlignment.Center; mLayout.AddView(txtView); mLayout.AddView(btn); mLayout.AddView(surface); SetContentView(mLayout); }
public static void StyleUILabel( TextView label, string font, uint size ) { label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) ); label.SetBackgroundColor( Android.Graphics.Color.Transparent ); label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal ); label.SetTextSize( Android.Util.ComplexUnitType.Dip, size ); }
private View createColumn(Context context, string ev) { TextView view = new TextView(context); view.SetPadding(20, 0, 0, 0); view.SetBackgroundColor(Android.Graphics.Color.White); view.Text = ev; view.SetTextColor(Android.Graphics.Color.ParseColor("#3B3477")); return view; }
protected override void OnElementChanged (ElementChangedEventArgs<Page> e) { base.OnElementChanged (e); MessagingCenter.Subscribe<RootPage, AlertArguments> (this, "DisplayAlert", (sender, arguments) => { //If you would like to use style attributes, you can pass this into the builder // ContextThemeWrapper customDialog = new ContextThemeWrapper(Context, Resource.Style.AlertDialogCustom); // AlertDialog.Builder builder = new AlertDialog.Builder(customDialog); //Create instance of AlertDialog.Builder and create the alert AlertDialog.Builder builder = new AlertDialog.Builder(Context); var alert = builder.Create(); //Utilize context to get LayoutInflator to set the view used for the dialog var layoutInflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService); alert.SetView(layoutInflater.Inflate(Resource.Layout.CustomDialog,null)); //Create a custom title element TextView title = new TextView (Context) { Text = arguments.Title, }; title.SetTextColor(Android.Graphics.Color.DodgerBlue); title.SetBackgroundColor(Android.Graphics.Color.White); //Add the custom title to the AlertDialog alert.SetCustomTitle(title); //Set the buttons text and click handler events if (arguments.Accept != null) alert.SetButton ((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult (true)); alert.SetButton ((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult (false)); alert.CancelEvent += (o, args) => { arguments.SetResult (false); }; alert.Show (); //This code grabs the line that separates the title and dialog. int titleDividerId = Resources.GetIdentifier("titleDivider", "id", "android"); Android.Views.View titleDivider = alert.FindViewById(titleDividerId); if (titleDivider != null) titleDivider.SetBackgroundColor(Android.Graphics.Color.DarkRed); //Set properties of the buttons Android.Widget.Button positiveButton = alert.GetButton((int)DialogButtonType.Positive); positiveButton.SetTextColor(Android.Graphics.Color.Green); positiveButton.SetBackgroundColor(Android.Graphics.Color.White); Android.Widget.Button negativeButton = alert.GetButton((int)DialogButtonType.Negative); negativeButton.SetTextColor(Android.Graphics.Color.Red); negativeButton.SetBackgroundColor(Android.Graphics.Color.White); //Set the text of the TextView in the dialog var textView = alert.FindViewById<TextView>(Resource.Id.textview); textView.SetText(arguments.Message,null); }); }
private View CreateView(TestRunInfo testRunDetails) { LinearLayout layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; TextView titleTextView = new TextView(this); titleTextView.LayoutParameters = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FillParent, 48); titleTextView.SetBackgroundColor(Color.Argb(255,50,50,50)); titleTextView.SetPadding(20,0,20,0); titleTextView.Gravity = GravityFlags.CenterVertical; titleTextView.Text = testRunDetails.Description; titleTextView.Ellipsize = TextUtils.TruncateAt.Start; TextView descriptionTextView = new TextView(this); descriptionTextView.LayoutParameters = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { LeftMargin = 40, RightMargin = 40 }; if (testRunDetails.Running) { descriptionTextView.Text = "Test is currently running."; } else if (testRunDetails.Passed) { descriptionTextView.Text = "wohhoo, Test has passed."; } else if (testRunDetails.TestResult != null) { descriptionTextView.Text = testRunDetails.TestResult.Message + "\r\n\r\n" + testRunDetails.TestResult.StackTrace; } ScrollView scrollView = new ScrollView(this); scrollView.LayoutParameters = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); scrollView.AddView(descriptionTextView); layout.AddView(titleTextView); layout.AddView(scrollView); return layout; }
// [END mListener_variable_reference] // [START auth_oncreate_setup_beginning] protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Put application specific code here. // [END auth_oncreate_setup_beginning] SetContentView (Resource.Layout.activity_main); logView = FindViewById<TextView> (Resource.Id.sample_logview); logView.SetTextAppearance (this, Resource.Style.Log); logView.SetBackgroundColor (Android.Graphics.Color.White); logView.Append ("\r\n"); // [START auth_oncreate_setup_ending] if (savedInstanceState != null) authInProgress = savedInstanceState.GetBoolean (AUTH_PENDING); buildFitnessClient(); }
private void UpdateMemoryTableUI() { tlData.RemoveAllViews(); foreach (var memoryItem in store.Items) { TableRow tr = new TableRow(this); var rowColor = Color.White; tr.SetBackgroundColor(rowColor); var cellColor = Color.Black; var txtVal1 = new TextView(this) {Text = memoryItem.Values[0]}; txtVal1.SetPadding(1, 1, 1, 1); tr.AddView(txtVal1); txtVal1.SetBackgroundColor(cellColor); var txtVal2 = new TextView(this) {Text = memoryItem.Values[1]}; txtVal2.SetPadding(1, 1, 1, 1); txtVal2.SetBackgroundColor(cellColor); tr.AddView(txtVal2); tlData.AddView(tr); } }
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) { base.OnElementChanged(e); nativeTextView = Control; if (nativeTextView == null) { return; } if (this.Element != null) formsEntry = this.Element as CustomEntry; if (formsEntry != null && !string.IsNullOrEmpty (formsEntry.BackGroundImageName)) { Android.Graphics.Drawables.Drawable drawable = Resources.GetDrawable (Resource.Drawable.comnt_box); nativeTextView.Background = drawable; } else { nativeTextView.SetBackgroundColor(Android.Graphics.Color.White); nativeTextView.SetHintTextColor(Android.Graphics.Color.Gray); } nativeTextView.SetTextColor(Android.Graphics.Color.Gray); if (nativeTextView != null) { if (nativeTextView.Text != null) { // nativeTextView.SetTextColor(Android.Graphics.Color.Black); } } if (App.screenDensity > 1.5) { nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 8); } else { nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 9); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); abs = new AbsoluteLayout(this); sensorText = new TextView(this); sensorText.SetBackgroundColor(new Color(192, 192, 192)); sensorText.Gravity = GravityFlags.Center; SetContentView(abs); sensorManager = (SensorManager)GetSystemService(SensorService); //Point prealsize = new Point(); //WindowManager.DefaultDisplay.GetRealSize(prealsize); // ディスプレイサイズ取得(4.2以降) //Log.Debug("Info", string.Format("Width(GetRealSize): {0}, Height(GetRealSize): {1}", prealsize.X ,prealsize.Y); //Point psize = new Point(); //WindowManager.DefaultDisplay.GetSize(psize); // ナビゲーションバー以外のサイズ //Log.Debug("Info", string.Format("Width(GetSize): {0}, Height(GetSize): {1}", psize.X, psize.Y); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //先初始化BMapManager DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(this); app.mBMapManager.Init( new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.activity_panorama_main); mPanoramaView = FindViewById<PanoramaView>(Resource.Id.panorama); //UI初始化 mBtn = FindViewById<Button>(Resource.Id.button); mBtn.Visibility = ViewStates.Invisible; //道路名 mRoadName = FindViewById<TextView>(Resource.Id.road); mRoadName.Visibility = ViewStates.Visible; mRoadName.Text = "百度全景"; mRoadName.SetBackgroundColor(Color.Argb(200, 5, 5, 5)); //背景透明度 mRoadName.SetTextColor(Color.Argb(255, 250, 250, 250)); //文字透明度 mRoadName.TextSize = 22; //跳转进度条 pd = new ProgressDialog(this); pd.SetMessage("跳转中……"); pd.SetCancelable(true);//设置进度条是否可以按退回键取消 //初始化Searvice mService = PanoramaService.GetInstance(ApplicationContext); mCallback = new IPanoramaServiceCallbackImpl(this); //设置全景图监听 mPanoramaView.SetPanoramaViewListener(this); //解析输入 ParseInput(); }
public TestRunDetailsView(Context context, TestRunInfo testRunDetails) : base(context) { Orientation = Orientation.Vertical; var titleTextView = new TextView(context) { LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.FillParent, 48) }; titleTextView.SetBackgroundColor(Color.Argb(255,50,50,50)); titleTextView.SetPadding(20,0,20,0); titleTextView.Gravity = GravityFlags.CenterVertical; titleTextView.Text = testRunDetails.Description; titleTextView.Ellipsize = TextUtils.TruncateAt.Start; _descriptionTextView = new TextView(context) { LayoutParameters = new LayoutParams( ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent) { LeftMargin = 40, RightMargin = 40 } }; var scrollView = new ScrollView(context) { LayoutParameters = new LayoutParams( ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent) }; scrollView.AddView(_descriptionTextView); AddView(titleTextView); AddView(scrollView); }
private View createDoubleHour(Context context, string ev) { TextView view = new TextView(context); view.SetPadding(0, 0, 20, 0); view.SetBackgroundColor(Android.Graphics.Color.White); string[] spl = ev.Split('a'); view.Text = spl[0].TrimEnd(' ')+"\na"+spl[1]; view.SetTextColor(Android.Graphics.Color.ParseColor("#3B3477")); view.Gravity = GravityFlags.Right; return view; }
/// <summary> /// Raises the create event. /// </summary> /// <param name="bundle">Bundle.</param> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // hide title bar. this.RequestWindowFeature(global::Android.Views.WindowFeatures.NoTitle); // initialize map. var map = new Map(); map.AddLayer(new LayerMBTile(OsmSharp.Android.UI.Data.SQLite.SQLiteConnection.CreateFrom( Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.kempen.mbtiles"), "map"))); // add a tile layer. //var layer = new LayerTile(@"http://a.tiles.mapbox.com/v3/osmsharp.i8ckml0l/{0}/{1}/{2}.png"); //map.AddLayer(layer); //layer.IsVisible = false; //map.AddLayer(new LayerTile(@"http://a.tiles.mapbox.com/v3/osmsharp.i8ckml0l/{0}/{1}/{2}.png")); //map.AddLayerGpx(Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.regression1.gpx")); // // add an on-line osm-data->mapCSS translation layer. //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter)); // add a preprocessed vector data file. //var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.default.map"); //map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true))); //// define dummy from and to points. //var from = new GeoCoordinate(51.261203, 4.780760); //var to = new GeoCoordinate(51.267797, 4.801362); //// deserialize the preprocessed graph. //var routingSerializer = new CHEdgeDataDataSourceSerializer(); //var graphStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.kempen-big.osm.pbf.routing"); //var graphDeserialized = routingSerializer.Deserialize(graphStream, true); //// initialize router. //_router = Router.CreateCHFrom(graphDeserialized, new CHRouter(), new OsmRoutingInterpreter()); //// resolve points. //var routerPoint1 = _router.Resolve(Vehicle.Car, from); //var routerPoint2 = _router.Resolve(Vehicle.Car, to); //// calculate route. //var route = _router.Calculate(Vehicle.Car, routerPoint1, routerPoint2); //// add a router layer. //_routeLayer = new LayerRoute(map.Projection); //_routeLayer.AddRoute(route, SimpleColor.FromKnownColor(KnownColor.Blue, 125).Value, 12); //map.AddLayer(_routeLayer); // define the mapview. _mapView = new MapView(this, new MapViewSurface(this)); //_mapView = new MapView(this, new MapViewGLSurface(this)); //_mapView.MapTapEvent += new MapViewEvents.MapTapEventDelegate(_mapView_MapTapEvent); _mapView.MapTapEvent += _mapView_MapTapEvent; _mapView.Map = map; //_mapView.MapMaxZoomLevel = 20; //_mapView.MapMinZoomLevel = 10; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.261203, 4.780760); _mapView.MapZoom = 16; _mapView.MapAllowTilt = false; _mapView.MapTouchedUp += _mapView_MapTouchedUp; _mapView.MapTouched += _mapView_MapTouched; _mapView.MapTouchedDown += _mapView_MapTouchedDown; // AddMarkers(); // AddControls(); // initialize a text view to display routing instructions. _textView = new TextView(this); _textView.SetBackgroundColor(global::Android.Graphics.Color.White); _textView.SetTextColor(global::Android.Graphics.Color.Black); // add the mapview to the linear layout. var layout = new RelativeLayout(this); //layout.Orientation = Orientation.Vertical; //layout.AddView(_textView); layout.AddView(_mapView); // create the route tracker animator. //_routeTrackerAnimator = new RouteTrackerAnimator(_mapView, routeTracker, 5, 17); // simulate a mapzoom change every 5 seconds. //Timer timer = new Timer(5000); //timer.Elapsed += new ElapsedEventHandler(TimerHandler); //timer.Start(); _centerMarker = _mapView.AddMarker(_mapView.MapCenter); _mapView.MapInitialized += _mapView_MapInitialized; SetContentView(layout); }
public DoubleNewsListItem( Context context ) : base( context ) { Orientation = Orientation.Horizontal; SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); LeftLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftLayout.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); AddView( LeftLayout ); LeftImage = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftImage.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)LeftImage.LayoutParameters ).Gravity = GravityFlags.CenterVertical; LeftImage.SetScaleType( ImageView.ScaleType.CenterCrop ); LeftLayout.AddView( LeftImage ); LeftButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftButton.LayoutParameters = LeftImage.LayoutParameters; LeftButton.Background = null; LeftButton.Click += (object sender, EventArgs e ) => { // notify our parent that the image index was clicked ParentAdapter.RowItemClicked( LeftImageIndex ); }; LeftLayout.AddView( LeftButton ); LeftPrivateOverlay = new TextView( context ); LeftPrivateOverlay.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); LeftPrivateOverlay.SetBackgroundColor( Android.Graphics.Color.Red ); LeftPrivateOverlay.Alpha = .60f; LeftPrivateOverlay.Text = "Private"; LeftPrivateOverlay.Gravity = GravityFlags.Center; LeftLayout.AddView( LeftPrivateOverlay ); RightLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightLayout.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); AddView( RightLayout ); RightImage = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightImage.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)RightImage.LayoutParameters ).Gravity = GravityFlags.CenterVertical; RightImage.SetScaleType( ImageView.ScaleType.CenterCrop ); RightLayout.AddView( RightImage ); RightButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightButton.LayoutParameters = RightImage.LayoutParameters; RightButton.Background = null; RightButton.Click += (object sender, EventArgs e ) => { // notify our parent that the image index was clicked ParentAdapter.RowItemClicked( LeftImageIndex + 1 ); }; RightLayout.AddView( RightButton ); RightPrivateOverlay = new TextView( context ); RightPrivateOverlay.LayoutParameters = new RelativeLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, ViewGroup.LayoutParams.WrapContent ); RightPrivateOverlay.SetBackgroundColor( Android.Graphics.Color.Red ); RightPrivateOverlay.Alpha = .60f; RightPrivateOverlay.Text = "Private"; RightPrivateOverlay.Gravity = GravityFlags.Center; RightLayout.AddView( RightPrivateOverlay ); }
public SingleNewsListItem( Context context ) : base( context ) { SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); RelativeLayout = new RelativeLayout( context ); RelativeLayout.LayoutParameters = new AbsListView.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); AddView( RelativeLayout ); Billboard = new AspectScaledImageView( context ); Billboard.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); Billboard.SetScaleType( ImageView.ScaleType.CenterCrop ); Billboard.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); RelativeLayout.AddView( Billboard ); PrivateOverlay = new TextView( context ); PrivateOverlay.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); PrivateOverlay.SetBackgroundColor( Android.Graphics.Color.Red ); PrivateOverlay.Alpha = .60f; PrivateOverlay.Text = "Private"; PrivateOverlay.Gravity = GravityFlags.Center; RelativeLayout.AddView( PrivateOverlay ); }
private void CreateStackTraceSection(LinearLayout mainLayout) { this.m_stackTraceInfo = new LinearLayout(this); this.m_stackTraceInfo.Orientation = Orientation.Vertical; this.m_stackTraceInfo.LayoutParameters = LayoutParams.ForLL(weight: 1); Button logButton = new Button(this); logButton.Text = "Dump exception to logcat"; logButton.Click += (s, e) => DumpStackTrace(); logButton.LayoutParameters = LayoutParams.ForLL(); this.m_stackTraceInfo.AddView(logButton); if (!AreLineNumbersAvailable()) { TextView noteText = new TextView(this); noteText.LayoutParameters = LayoutParams.ForLL(margin: 7, marginTop: 0); noteText.TextFormatted = Html.FromHtml("<b>Line numbers are unavailable because no debugger is attached."); noteText.SetPadding(5, 2, 5, 2); noteText.Gravity = GravityFlags.Center; noteText.SetBackgroundColor(new Color(110, 3, 15)); this.m_stackTraceInfo.AddView(noteText); } this.m_stackTraceText = new TextView(this); this.m_stackTraceText.Typeface = Typeface.Monospace; this.m_stackTraceText.SetTextSize(ComplexUnitType.Px, GetPreferredListItemHeight() / 6); this.m_stackTraceText.LayoutParameters = LayoutParams.ForLL(weight: 1); this.m_stackTraceText.VerticalScrollBarEnabled = true; this.m_stackTraceText.MovementMethod = new ScrollingMovementMethod(); // Necessary so that the text color doesn't get darkened when scrolling the text view this.m_stackTraceText.SetTextColor(Color.White); this.m_stackTraceInfo.AddView(this.m_stackTraceText); mainLayout.AddView(this.m_stackTraceInfo); }
private View createHour(Context context, string ev) { TextView view = new TextView(context); view.SetPadding(0, 0, 20, 0); view.SetBackgroundColor(Android.Graphics.Color.White); view.Text = ev; view.SetTextColor(Android.Graphics.Color.ParseColor("#3B3477")); view.Gravity = GravityFlags.CenterVertical; view.Gravity = GravityFlags.Right; return view; }
TextView MakeHeaderView () { var result = new TextView (context) { Gravity = GravityFlags.Center, TextSize = 10, }; result.SetPadding (4, 4, 4, 4); result.SetBackgroundColor (Color.Rgb (0x22, 0x22, 0x22)); result.SetAllCaps (true); result.SetTypeface (Typeface.DefaultBold, TypefaceStyle.Bold); result.SetTextColor (Color.White); return result; }
private void markTabAsActive(TextView activeTab, View underline) { activeTab.SetBackgroundColor(Color.ParseColor("#000000")); underline.Visibility = ViewStates.Visible; }
/// <summary> /// Raises the create event. /// </summary> /// <param name="bundle">Bundle.</param> protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // enable the logggin. OsmSharp.Logging.Log.Enable(); OsmSharp.Logging.Log.RegisterListener(new OsmSharp.Android.UI.Log.LogTraceListener()); // initialize map. var map = new Map(); // add a tile layer. //map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png")); // add an online osm-data->mapCSS translation layer. //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter)); // add a pre-processed vector data file. var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.kempen-big.osm.pbf.scene.layered"); map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true))); // define dummy from and to points. var from = new GeoCoordinate(51.261203, 4.780760); var to = new GeoCoordinate(51.267797, 4.801362); // deserialize the pre-processed graph. var routingSerializer = new CHEdgeDataDataSourceSerializer(false); TagsCollectionBase metaData = null; var graphStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.kempen-big.osm.pbf.routing"); var graphDeserialized = routingSerializer.Deserialize(graphStream, out metaData, true); // initialize router. _router = Router.CreateCHFrom(graphDeserialized, new CHRouter(), new OsmRoutingInterpreter()); // resolve points. RouterPoint routerPoint1 = _router.Resolve(Vehicle.Car, from); RouterPoint routerPoint2 = _router.Resolve(Vehicle.Car, to); // calculate route. Route route = _router.Calculate(Vehicle.Car, routerPoint1, routerPoint2); RouteTracker routeTracker = new RouteTracker(route, new OsmRoutingInterpreter()); _enumerator = route.GetRouteEnumerable(10).GetEnumerator(); // add a router layer. _routeLayer = new LayerRoute(map.Projection); _routeLayer.AddRoute (route, SimpleColor.FromKnownColor(KnownColor.Blue, 125).Value, 12); map.AddLayer(_routeLayer); // define the mapview. _mapView = new MapView(this, new MapViewSurface(this)); //_mapView = new MapView(this, new MapViewGLSurface(this)); //_mapView.MapTapEvent += new MapViewEvents.MapTapEventDelegate(_mapView_MapTapEvent); (_mapView as IMapView).AutoInvalidate = true; _mapView.Map = map; _mapView.MapMaxZoomLevel = 20; _mapView.MapMinZoomLevel = 10; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.26371, 4.78601); _mapView.MapZoom = 18; // add markers. _mapView.AddMarker (from); _mapView.AddMarker (to); // initialize a text view to display routing instructions. _textView = new TextView(this); _textView.SetBackgroundColor(global::Android.Graphics.Color.White); _textView.SetTextColor(global::Android.Graphics.Color.Black); // add the mapview to the linear layout. var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; layout.AddView(_textView); layout.AddView(_mapView); // create the route tracker animator. _routeTrackerAnimator = new RouteTrackerAnimator(_mapView, routeTracker, 5, 18); // simulate a number of gps-location update along the calculated route. Timer timer = new Timer(500); timer.Elapsed += new ElapsedEventHandler(TimerHandler); timer.Start(); SetContentView (layout); }
public SeriesPrimaryListItem( Context context ) : base( context ) { SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); Orientation = Orientation.Vertical; /*Header = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Header.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Header.Text = MessagesStrings.Series_TopBanner; Header.SetTypeface( Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Header.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize ); Header.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); ( (LinearLayout.LayoutParams)Header.LayoutParameters ).Gravity = GravityFlags.Center; AddView( Header );*/ Billboard = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Billboard.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); Billboard.SetScaleType( ImageView.ScaleType.CenterCrop ); AddView( Billboard ); Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize ); Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 8 ); AddView( Title ); DetailsLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); DetailsLayout.Orientation = Orientation.Horizontal; DetailsLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)DetailsLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical; ( (LinearLayout.LayoutParams)DetailsLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 ); ( (LinearLayout.LayoutParams)DetailsLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 8 ); ( (LinearLayout.LayoutParams)DetailsLayout.LayoutParameters ).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 8 ); ( (LinearLayout.LayoutParams)DetailsLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 5 ); AddView( DetailsLayout ); Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); DetailsLayout.AddView( Date ); // fill the remaining space with a dummy view, and that will align our speaker to the right View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 ); ( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1; DetailsLayout.AddView( dummyView ); Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); DetailsLayout.AddView( Speaker ); // setup the buttons ButtonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ButtonLayout.Orientation = Orientation.Horizontal; ButtonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent ); AddView( ButtonLayout ); // Watch Button WatchButton = new BorderedActionButton(); WatchButton.AddToView( ButtonLayout ); ( (LinearLayout.LayoutParams)WatchButton.Layout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -5 ); ( (LinearLayout.LayoutParams)WatchButton.Layout.LayoutParameters ).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -1 ); ( (LinearLayout.LayoutParams)WatchButton.Layout.LayoutParameters ).Weight = 1; WatchButton.Layout.BorderWidth = 1; WatchButton.Layout.SetBorderColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); WatchButton.Layout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); WatchButton.Icon.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary ), TypefaceStyle.Normal ); WatchButton.Icon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Series_Table_IconSize ); WatchButton.Icon.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); WatchButton.Icon.Text = PrivateNoteConfig.Series_Table_Watch_Icon; WatchButton.Label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); WatchButton.Label.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); WatchButton.Label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); WatchButton.Label.Text = MessagesStrings.Series_Table_Watch; WatchButton.Button.Click += (object sender, EventArgs e ) => { ParentAdapter.WatchButtonClicked( ); }; // // TakeNotes Button TakeNotesButton = new BorderedActionButton(); TakeNotesButton.AddToView( ButtonLayout ); ( (LinearLayout.LayoutParams)TakeNotesButton.Layout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -2 ); ( (LinearLayout.LayoutParams)TakeNotesButton.Layout.LayoutParameters ).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -5 ); ( (LinearLayout.LayoutParams)TakeNotesButton.Layout.LayoutParameters ).Weight = 1; TakeNotesButton.Layout.BorderWidth = 1; TakeNotesButton.Layout.SetBorderColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); TakeNotesButton.Layout.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); TakeNotesButton.Icon.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary ), TypefaceStyle.Normal ); TakeNotesButton.Icon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Series_Table_IconSize ); TakeNotesButton.Icon.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); TakeNotesButton.Icon.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon; TakeNotesButton.Label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); TakeNotesButton.Label.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); TakeNotesButton.Label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); TakeNotesButton.Label.Text = MessagesStrings.Series_Table_TakeNotes; TakeNotesButton.Button.Click += (object sender, EventArgs e ) => { ParentAdapter.TakeNotesButtonClicked( ); }; // Footer = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Footer.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)Footer.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -5 ); Footer.Text = MessagesStrings.Series_Table_PreviousMessages; Footer.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Footer.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); Footer.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); Footer.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Table_Footer_Color ) ); Footer.Gravity = GravityFlags.Center; AddView( Footer ); }
private void Initialize() { WaveformLayout = new WaveFormLayout(this); WaveformLayout.LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.FillParent, LayoutParams.FillParent, GravityFlags.CenterHorizontal | GravityFlags.CenterVertical); AddView(WaveformLayout); _lblZoom = new TextView(Context); _lblZoom.Typeface = Typeface.Default; _lblZoom.SetTextSize(ComplexUnitType.Dip, 11); _lblZoom.LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent, GravityFlags.CenterHorizontal | GravityFlags.CenterVertical); _lblZoom.SetPadding(12, 4, 12, 4); _lblZoom.SetBackgroundColor(new Color(32, 40, 46, 150)); _lblZoom.SetTextColor(Color.White); _lblZoom.Text = "100%"; _lblZoom.Gravity = GravityFlags.CenterVertical | GravityFlags.CenterHorizontal; _lblZoom.Alpha = 0; AddView(_lblZoom); _timerFadeOutZoomLabel = new Timer(100); _timerFadeOutZoomLabel.Elapsed += HandleTimerFadeOutZoomLabelElapsed; _timerFadeOutZoomLabel.Start(); }
private void SetTimeRemaining(NotificationFeedFragment master, int containerId, Notification notification, TextView timeRemainingTextView, ImageView clockImageView) { if ( notification.type == Strings.notification_type_post_expired || notification.type == Strings.notification_type_following || notification.type == Strings.notification_type_follow || notification.type == Strings.notification_type_friend_request) { clockImageView.Visibility = ViewStates.Invisible; timeRemainingTextView.Visibility = ViewStates.Invisible; } else { clockImageView.Visibility = ViewStates.Visible; timeRemainingTextView.Visibility = ViewStates.Visible; if (notification.post != null) { if (notification.post.IsExpired()) { string timeRemaining = StringUtils.GetTopTime(notification.post); timeRemainingTextView.Text = timeRemaining; timeRemainingTextView.SetTextColor(Color.White); timeRemainingTextView.SetBackgroundResource(Resource.Drawable.RoundedCorners5Black); clockImageView.Visibility = ViewStates.Invisible; } else { string timeRemaining = StringUtils.GetPrettyDateAbs(notification.post.expiration); timeRemainingTextView.Text = timeRemaining; Color timeRemainingColor = ViewUtils.GetTimeRemainingColor(notification.post.expiration); timeRemainingTextView.SetTextColor(timeRemainingColor); timeRemainingTextView.SetBackgroundColor(Color.Transparent); clockImageView.Visibility = ViewStates.Visible; } } if (!clockImageView.HasOnClickListeners) { clockImageView.Click += (sender, e) => { TenServiceHelper.GoToListOf(master.FragmentManager, containerId, notification.post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed); }; } if (!timeRemainingTextView.HasOnClickListeners) { timeRemainingTextView.Click += (sender, e) => { TenServiceHelper.GoToListOf(master.FragmentManager, containerId, notification.post.idPost, FeedTypeEnum.FeedType.LikersListOfFeed); }; } } }
private void markTabAsInactive(TextView inactiveTab, View underline) { inactiveTab.SetBackgroundColor(Color.ParseColor("#333333")); underline.Visibility = ViewStates.Gone; }
private void Init() { base.RemoveAllViews(); hintTextView = new EditText(Context); textTextView = new NoCursorMovingEditText(Context, BackKeyPressed); linearLayout = new LinearLayout(Context); linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight()); textLayout = new RelativeLayout(Context); textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1); textLayout.SetGravity(GravityFlags.Center); linearLayout.AddView(textLayout); textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText); hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText); LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); lp.AddRule(LayoutRules.CenterVertical); hintTextView.LayoutParameters = lp; textTextView.LayoutParameters = lp; hintTextView.Enabled = false; hintTextView.Focusable = false; textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions; hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions; hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent)); textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent)); int horizontalPadding = Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding); hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0); textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0); textErrorView = new EditText(Context); RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); errorLP.AddRule(LayoutRules.CenterVertical); int margin = UiUtils.ToPixels(Context, 2); errorLP.SetMargins(margin, 0, margin, 0); textErrorView.LayoutParameters = errorLP; textErrorView.Enabled = false; textErrorView.Focusable = false; textErrorView.Visibility = ViewStates.Gone; textErrorView.SetBackgroundColor(Color.Red); int errorVerticalPadding = Context.Resources.GetDimensionPixelOffset( Resource.Dimension.backgroundhinttextview_error_vertical_padding); textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding); textErrorView.Text = errorText; textErrorView.SetSingleLine(true); textErrorView.Gravity = GravityFlags.Center; textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText); //set courier font Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier); //hintTextView.Typeface = type; hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); //textTextView.Typeface = type; textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); textErrorView.Typeface = type; textLayout.AddView(hintTextView); textLayout.AddView(textTextView); AddView(linearLayout); IEnumerable<char> previousCharSequence; EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) => { previousCharSequence = args.Text; }; EventHandler<TextChangedEventArgs> textChanged = (sender, args) => { beforeTextSize = args.BeforeCount; }; EventHandler<AfterTextChangedEventArgs> afterTextChanged = null; Action<string> updateTextView = newText => { textTextView.TextChanged -= textChanged; textTextView.BeforeTextChanged -= beforeTextChanged; textTextView.AfterTextChanged -= afterTextChanged; textTextView.Text = newText; textTextView.TextChanged += textChanged; textTextView.BeforeTextChanged += beforeTextChanged; textTextView.AfterTextChanged += afterTextChanged; }; afterTextChanged = (sender, args) => { var length = args.Editable.ToString().Length; var deleting = beforeTextSize == 1; if (deleting) { nextMustBeDeleted = false; } else { if (nextMustBeDeleted && length > 0) { updateTextView(args.Editable.SubSequence(0, length - 1)); UpdateHintTextForCurrentTextEntry(); return; } } // If we are deleting (we've just removed a space char, so delete another char please: // Or if we've pressed space don't allow it! if ((deleting && skipCharsAtPositions.Contains(length)) || (length > 0 && IsCharInFilter(args.Editable.CharAt(length - 1)) && !skipCharsAtPositions.Contains(length - 1))) { updateTextView(length == 0 ? "" : args.Editable.SubSequence(0, length - 1)); textTextView.SetSelection(length == 0 ? 0 : length - 1); UpdateHintTextForCurrentTextEntry(); return; } // Adds a non numeric char at positions needed for (int i = 0; i < skipCharsAtPositions.Count; ++i) { // We rescan all letters recursively to catch when a users pastes into the edittext int charPosition = skipCharsAtPositions[i]; if (length > charPosition) { if (hintText[charPosition] != args.Editable.ToString()[charPosition]) { updateTextView(args.Editable.SubSequence(0, charPosition) + "" + hintText[charPosition] + args.Editable.SubSequence(charPosition, args.Editable.Length())); UpdateHintTextForCurrentTextEntry(); return; } } else { if (length == charPosition) { updateTextView(textTextView.Text + "" + hintText[charPosition]); } } } UpdateHintTextForCurrentTextEntry(); // We've got all the chars we need, fire off our listener if (length >= LengthToStartValidation()) { try { ValidateInput(args.Editable.ToString()); if (OnEntryComplete != null) { OnEntryComplete(args.Editable.ToString()); } return; } catch (Exception exception) { Log.Error(JudoSDKManager.DEBUG_TAG, exception.Message, exception); } ShowInvalid(); } else { if (OnProgress != null) { OnProgress(length); } } }; textTextView.BeforeTextChanged += beforeTextChanged; textTextView.TextChanged += textChanged; textTextView.AfterTextChanged += afterTextChanged; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.TestTable); mainTable = FindViewById <TableLayout> (Resource.Id.maintable); for (int i=0; i<10 ; i++){ // Create a TableRow and give it an ID TableRow tr = new TableRow(this); tr.Id = 100+i; tr.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent); // Create a TextView for column 1 TextView col1 = new TextView(this); col1.Id = 200+i; col1.Text = ("col1"); col1.SetPadding(0,0,2,0); col1.SetTextColor(Android.Graphics.Color.Black); col1.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent); tr.AddView(col1); // Create a TextView for column 2 TextView col2 = new TextView(this); col2.Id = 300 + i; col2.Text = "col2"; col2.SetPadding(0,0,2,0); col2.SetTextColor(Android.Graphics.Color.Black); col2.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent); tr.AddView(col2); // Create a TextView for column 3 TextView col3 = new TextView(this); col3.Id = 500+i; col3.Text = DateTime.Now.ToString("dd.MM"); col3.SetTextColor(Android.Graphics.Color.Black); if (i%2 == 0) { col1.SetBackgroundColor(Android.Graphics.Color.White); col2.SetBackgroundColor(Android.Graphics.Color.White); col3.SetBackgroundColor(Android.Graphics.Color.White); tr.SetBackgroundColor(Android.Graphics.Color.White); } else { tr.SetBackgroundColor(Android.Graphics.Color.LightGray); col1.SetBackgroundColor(Android.Graphics.Color.LightGray); col2.SetBackgroundColor(Android.Graphics.Color.LightGray); col3.SetBackgroundColor(Android.Graphics.Color.LightGray); } col3.SetHorizontallyScrolling(false); col3.SetMaxLines(100); col3.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent, 1f); tr.AddView(col3); // Add the TableRow to the TableLayout mainTable.AddView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent)); //i++; } }
public override ViewHolder OnCreateViewHolder (ViewGroup parent) { var view = new TextView (parent.Context); view.LayoutParameters = (new ViewGroup.LayoutParams (GRID_ITEM_WIDTH, GRID_ITEM_HEIGHT)); view.Focusable = (true); view.FocusableInTouchMode = (true); view.SetBackgroundColor (owner.Resources.GetColor (Resource.Color.default_background)); view.SetTextColor (Color.White); view.Gravity = GravityFlags.Center; return new ViewHolder (view); }
/// <summary> /// Raises the create event. /// </summary> /// <param name="bundle">Bundle.</param> protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); OsmSharp.Logging.Log.Enable(); OsmSharp.Logging.Log.RegisterListener( new OsmSharp.Android.UI.Log.LogTraceListener()); // initialize map. var map = new Map(); //map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png")); //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter)); // map.AddLayer(new LayerScene(Scene2DSimple.Deserialize( // Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.osm.pbf.scene.simple"), true))); map.AddLayer( new LayerScene( Scene2D.Deserialize( Assembly.GetExecutingAssembly().GetManifestResourceStream( @"OsmSharp.Android.UI.Sample.kempen-big/osm.pbf.scene.layered"), true))); var from = new GeoCoordinate(51.261203, 4.780760); var to = new GeoCoordinate(51.267797, 4.801362); var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.v2.CHEdgeDataDataSourceSerializer(false); TagsCollectionBase metaData = null; var graphDeserialized = routingSerializer.Deserialize( Assembly.GetExecutingAssembly().GetManifestResourceStream( "OsmSharp.Android.UI.Sample.kempen-big.osm.pbf.routing"), out metaData, true); _router = Router.CreateCHFrom( graphDeserialized, new CHRouter(), new OsmRoutingInterpreter()); RouterPoint routerPoint1 = _router.Resolve(Vehicle.Car, from); RouterPoint routerPoint2 = _router.Resolve(Vehicle.Car, to); Route route1 = _router.Calculate(Vehicle.Car, routerPoint1, routerPoint2); RouteTracker routeTracker = new RouteTracker(route1, new OsmRoutingInterpreter()); _enumerator = route1.GetRouteEnumerable(10).GetEnumerator(); _routeLayer = new LayerRoute(map.Projection); _routeLayer.AddRoute (route1, SimpleColor.FromKnownColor(KnownColor.Blue, 125).Value, 12); map.AddLayer(_routeLayer); _mapView = new MapView(this, new MapViewSurface(this)); //_mapView = new MapView(this, new MapViewGLSurface(this)); _mapView.MapTapEvent += new MapViewEvents.MapTapEventDelegate(_mapView_MapTapEvent); _mapView.Map = map; _mapView.MapAllowPan = true; _mapView.MapAllowTilt = true; _mapView.MapAllowZoom = true; (_mapView as IMapView).AutoInvalidate = true; _mapView.MapMaxZoomLevel = 20; _mapView.MapMinZoomLevel = 10; _mapView.MapTilt = 0; _mapView.MapCenter = new GeoCoordinate(51.26371, 4.78601); _mapView.MapZoom = 16; _textView = new TextView(this); _textView.SetBackgroundColor(global::Android.Graphics.Color.White); _textView.SetTextColor(global::Android.Graphics.Color.Black); //Create the user interface in code var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; layout.AddView(_textView); layout.AddView(_mapView); //_mapView.AddMarker(from); //_mapView.AddMarker(to); //_mapView.ZoomToMarkers(); _routeTrackerAnimator = new RouteTrackerAnimator(_mapView, routeTracker, 5, 17); //Timer timer = new Timer(500); //timer.Elapsed += new ElapsedEventHandler(TimerHandler); //timer.Start(); SetContentView (layout); }
void RefreshTable() { table.RemoveAllViews (); TableRow header = new TableRow (Activity); // header. header.SetMinimumHeight (88); TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams (); hParamsDrug.Height = TableLayout.LayoutParams.WrapContent; hParamsDrug.Width = TableLayout.LayoutParams.WrapContent; hParamsDrug.Gravity = GravityFlags.Center; // hParamsDrug.Span = 2; TextView hDrug = new TextView (Activity); hDrug.Text = @"Препараты"; hDrug.LayoutParameters = hParamsDrug; header.AddView(hDrug); TableRow.LayoutParams lpRow = new TableRow.LayoutParams (); lpRow.Height = TableLayout.LayoutParams.WrapContent; lpRow.Width = TableLayout.LayoutParams.WrapContent; lpRow.Gravity = GravityFlags.Center; // TableLayout.LayoutParams pp = new TableLayout.LayoutParams (); // pp. // TableLayout tlHeader = new TableLayout (Activity); // TableRow rAttendance = new TableRow (Activity); foreach (var attendace in currentAttendances) { TextView hAttendace = new TextView (Activity); hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd"); hAttendace.LayoutParameters = lpRow; hAttendace.Rotation = -70; header.AddView (hAttendace); // rAttendance.AddView(hAttendace); } // tlHeader.AddView (rAttendance); // header.AddView (tlHeader); // table.AddView(header); foreach (var info in infos) { TableRow r = new TableRow (Activity); TextView v = new TextView (Activity); v.Gravity = GravityFlags.Center; v.SetSingleLine (false); v.SetMinimumHeight (72); v.SetMinimumWidth (68); v.Rotation = -90; // v.SetBackgroundResource (Resource.Style.text_row); // v.SetB // v.Text = info.infoID.ToString(); // v.Text = GetInfo(info.infoID).name; // v.SetHorizontallyScrolling (false); v.Text = info.name; v.LayoutParameters = lpRow; r.AddView (v); TableLayout tl = new TableLayout (Activity); if (header.Parent == null) { tl.AddView (header); } tl.Id = info.id; foreach (var drug in drugs) { TableRow rr = new TableRow (Activity); rr.Id = drug.id; TextView vv = new TextView (Activity); vv.Gravity = GravityFlags.Center; vv.SetMinimumHeight (42); vv.SetMinimumWidth (76); // vv.Text = drugInfo.drugID.ToString(); // vv.Text = GetDrug(drugInfo.drugID).fullName; vv.Text = drug.fullName; vv.LayoutParameters = lpRow; vv.SetBackgroundColor (Android.Graphics.Color.White); rr.AddView (vv); foreach (var attendace in currentAttendances) { TableRow.LayoutParams lpValue = new TableRow.LayoutParams (); lpValue.Height = TableLayout.LayoutParams.WrapContent; lpValue.Width = TableLayout.LayoutParams.WrapContent; lpValue.Gravity = GravityFlags.Center; lpValue.SetMargins (1, 1, 1, 1); RelativeLayout rl = new RelativeLayout(Activity); rl.SetGravity (GravityFlags.Center); rl.SetMinimumHeight (68); rl.SetMinimumWidth (68); rl.LayoutParameters = lpValue; rl.Id = attendace.id; rl.SetTag (Resource.String.IDinfo, info.id); rl.SetTag (Resource.String.IDdrug, drug.id); rl.SetTag (Resource.String.IDattendance, attendace.id); string value = string.Empty; if (attendace.id != -1) { value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id); } else { value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id); rl.Click += Rl_Click; } TextView vvv = new TextView (Activity); vvv.Gravity = GravityFlags.Center; if (string.IsNullOrEmpty (value) || value.Equals(@"N")) { vvv.SetTextAppearance (Activity, Resource.Style.text_danger); // rl.SetBa rl.SetBackgroundColor (Android.Graphics.Color.LightPink); // rl.SetBackgroundResource(Resource.Style.alert_success); } else { vvv.SetTextAppearance (Activity, Resource.Style.text_success); // vvv.SetTextSize (ComplexUnitType.Sp, 24); // vvv.SetTextColor(Android.Graphics.Color.Argb); rl.SetBackgroundColor (Android.Graphics.Color.LightGreen); } vvv.Text = AttendanceResult.StringBoolToRussian(value); rl.AddView (vvv); rr.AddView (rl); } tl.AddView (rr); } r.AddView (tl); table.AddView (r); } }