xamarin.android

How to change font family of label in Xamarin.Forms

被刻印的时光 ゝ 提交于 2021-01-29 07:12:44
问题 I tried to change font-family of my label using CSS and XAML but the font is not reflecting. I am trying to use Montserrat font in my app. How can I fix this? XAML Code: <Label StyleClass="label" Text="Sample"/> CSS code: .label{ font-family: Montserrat; } 回答1: In order to use custom fonts in your project, you have to do the following: In your Android Project, place your font file in your Assets folder, and ensure the build type is AndroidAsset. Then you can, in your XAML, declare the font in

allow arabic text in pdf table using itext7 (xamarin android)

我只是一个虾纸丫 提交于 2021-01-29 07:11:07
问题 I have to put my list data in a table in a pdf file. My data has some Arabic words. When my pdf is generated, the Arabic words don't appear. I searched and found that I need itext7.pdfcalligraph so I installed it in my app. I found this code too https://itextpdf.com/en/blog/technical-notes/displaying-text-different-languages-single-pdf-document and tried to do something similar to allow Arabic words in my table but I couldn't figure it out. This is a trial code before I apply it to my real

Custom Notification Sound FireBase

吃可爱长大的小学妹 提交于 2021-01-29 06:16:54
问题 How I can send a notification to xamarin.android project to make the phone ring like calling I tried to create raw folder inside Resource and set my ringtone their but unfortunately it's not working is there any solution ? 回答1: Create a raw folder in Resource and put the mp3 file in it with AndroidResource Build Action. Set the custom sound of Notification channels would cover the default sound. You could use the custtom Notification via SetSound of channel. The Whole of creating channel:

Change Language for Xamarin Android App using Resources

落爺英雄遲暮 提交于 2021-01-29 05:15:23
问题 I have a requirement to change language of App on selection of radio buttons. App already has localization implemented using Android Resources. I have tried below solutions in different combinations from Activity as well as normal class, but nothing worked so far: CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(lang); // lang => en-US or nl-BE System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(lang); var locale = new Java.Util.Locale(lang); Java.Util.Locale

Converting Dates between Calendars in Xamarin.Android

一笑奈何 提交于 2021-01-29 03:57:14
问题 I have the following snippet of Code for Convert Gregorian Date to Hijri Date. public static string GregoriantoHijri(DateTime gregorianDate) { CultureInfo arCI = new CultureInfo("ar-SA"); var hijriCalendar = new HijriCalendar(); hijriCalendar.HijriAdjustment = App_Code.StoreRetrieveSettingsAssist.getHA(); arCI.DateTimeFormat.Calendar = hijriCalendar; //CODE FAILS HERE string hijriDate = gregorianDate.ToString("dd-MM-yyyy", arCI); return hijriDate; } This code runs perfectly for my Windows

Background Service error while using as async Task

五迷三道 提交于 2021-01-29 03:14:36
问题 I have a background service in Xamarin Android but the problem is I cannot use it as Async method, it gives an error. return type must be 'StartCommandResult' to match overridden member 'Service.OnStartCommand(Intent, StartCommandFlags, int) The actual overridden method is void but to use await I have to change it to async Task<T> and then it produces the error. I searched everywhere but couldn't find a proper solution on this. The code snippet for entire class is here: { [Service

Border being ignored on Android - Xamarin.Forms

ぃ、小莉子 提交于 2021-01-28 22:20:48
问题 I am attempting to build a circular button with a green border using Xamarin.Forms, using a method that I have used on previous projects by adding a BorderRadius, BorderColour etc values to the Button element. Please consider the following code: Button goButton = new Button { Text = "GO!", TextColor = Color.White, FontSize = 75, HeightRequest = 200, WidthRequest = 200, BorderRadius = 100, BorderWidth = 10, BorderColor = Color.Green, BackgroundColor = Color.Red }; The above code gives me the

Monodroid WebView Loading SSL page

你离开我真会死。 提交于 2021-01-28 21:48:47
问题 I have tried loading a WebView with a SSL page, and I am getting an error. Code and error below. I have set my permissions to allow Internet access. I think this is a Mono-only issue. When I try my SSL web page in the default browser it works fine. WebView webView = new WebView(this); string website = "https://..."; webView.Settings.JavaScriptEnabled = true; webView.SetWebViewClient(new WebViewClientAuthentication()); webView.LoadUrl(website); //definition for WebViewClientAuthentication

How to reference SQLite database that already exists in Xamarin.Android?

纵饮孤独 提交于 2021-01-28 16:49:14
问题 I have created SQLite database and have copied it in the root of the project like that: The database is called MobileSell.db It appears in Visual Studio like that: My question is how can I reference it so afterwards I can say connection.InsertIntoTableArticles(value)(this is pseudo code) 回答1: You can refer to this. There only three steps to achieve it: 1) Create Assets folder which is parallel with Resources folder in your project, put your .db file into it. 2) Copy the .db file to SDCard