-
Sep 22nd, 2017, 04:54 PM
#1
Thread Starter
Banned
[RESOLVED] xamarin: how to set the background image of the app ?
how to set the background image of the app programmatically in xamarin visual studio C# ?
-
Sep 25th, 2017, 09:42 AM
#2
Re: xamarin: how to set the background image of the app ?
You have some Page that is being displayed at any time. it has a BackgroundImage property. Set that property, and your "app" has a background image.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Sep 25th, 2017, 10:49 AM
#3
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
I already know how to set the BG property
I need to set it programmatically ! in order to use many different background images !
to be able to change the background image WHILE the app is running
programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically !!!!!!! not manually !
-
Sep 25th, 2017, 03:10 PM
#4
Re: xamarin: how to set the background image of the app ?
Thread moved from the 'General Developer' forum to our brand new 'Xamarin' forum
-
Sep 25th, 2017, 03:27 PM
#5
Re: xamarin: how to set the background image of the app ?
Originally Posted by bugsi
I already know how to set the BG property
I need to set it programmatically ! in order to use many different background images !
to be able to change the background image WHILE the app is running
programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically !!!!!!! not manually !
Sooo.... what's the problem? form.background = image.... It's a property. You set it like any other property, no? As long as you have a valid image loaded, you should be able to just set it.
-tg
-
Sep 26th, 2017, 08:50 AM
#6
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
-
Sep 26th, 2017, 10:17 AM
#7
Re: xamarin: how to set the background image of the app ?
No it's not a problem. It's actually not complaining about the background property... it's complaining about the form name... is your Form named "form"? No, I think not... It's named something else. Hard to tell what it is from the screen shot MSTOW-something or other... Additionally since you're in the form, you should be able to use "this" ... this.background = ... anytime you're in a class, the this keyword will refer to that instance of that class. the property is there... you're just not accessing it correctly.
-tg
-
Sep 27th, 2017, 07:11 AM
#8
Re: xamarin: how to set the background image of the app ?
this is xamarin, so it is not that easy. there are no forms in that sense and there is no filesystem where you can easily load an Image from.
so it is more complicated and not unusual for Newcomers to struggle.
i thought about knocking an example together but as my time is limited and i also Need to Research this as i have no finished code, i was not yet able to. The 70$ were also not enough to motivate me during the week. maybe on the Weekend where i might have some spare time...
-
Sep 27th, 2017, 08:02 AM
#9
Re: xamarin: how to set the background image of the app ?
-
Sep 27th, 2017, 11:04 AM
#10
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
-
Sep 27th, 2017, 12:34 PM
#11
Re: xamarin: how to set the background image of the app ?
We're trying to help, but we're not getting any helpt back... posting pictures of your screen with silly comments on them doesn't help... 1) I can only see half the code, so I don't know what the second half of it looks like, you've also hidden the top part of it, so I can't even tell if it's in the right spot. 2) there's a red squiggly underneath the line in question... so presumably you've screwed it up somehow... and there should be an error message to go with it... but rather than go find out what it is, you decided it would be better to make fun of the language. Instead, spend the time and just copy/paste the code here instead. Be sure to put [code][/code] tags around it... I have my suspicions as to what's wrong, but I can't tell from a 1/4 screen shot of the code.
Maybe someone else will help.
-tg
-
Sep 28th, 2017, 12:10 AM
#12
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
I placed it in the protected override void OnCreate(Bundle bundle)
{
-
Sep 28th, 2017, 07:09 AM
#13
Re: xamarin: how to set the background image of the app ?
I'm beginning to think you're doing something you shouldn't be doing since you seem to be reluctant to share your code so I'm out.
-tg
-
Sep 28th, 2017, 11:42 AM
#14
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
@tg
I don't have the energy to explain why the specific code is irrelevant so:
Code:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App15
{
[Activity(Label = "App15", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
-
Sep 28th, 2017, 02:41 PM
#15
Re: xamarin: how to set the background image of the app ?
Maybe you should take a nap and come back when you have the energy to be polite. I can see the problem clearly but I'm in too big a hurry to answer.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Oct 7th, 2017, 06:05 AM
#16
Thread Starter
Banned
Re: xamarin: how to set the background image of the app ?
-
Oct 7th, 2017, 07:26 AM
#17
Thread Starter
Banned
Re: [RESOLVED] xamarin: how to set the background image of the app ?
-
Mar 18th, 2020, 12:27 AM
#18
Lively Member
Re: [RESOLVED] xamarin: how to set the background image of the app ?
<Image Source="download1.jpg" Opacity="0.5" Grid.Row="0" />
<Image Source="horce.png" Grid.Row="0"/>
<StackLayout Grid.Row="0">
<Label Text="Uday" FontAttributes="Bold" FontSize="Large" HorizontalOptions="Center" VerticalOptions="EndAndExpand"/>
</StackLayout>
try it. it is work in my menubar. put to Grid.row="0"
When you set the background image to a smaller area
follow to code
-
Mar 18th, 2020, 12:28 AM
#19
Lively Member
Re: [RESOLVED] xamarin: how to set the background image of the app ?
HTML Code:
<Image Source="download1.jpg" Opacity="0.5" Grid.Row="0" />
<Image Source="horce.png" Grid.Row="0"/>
<StackLayout Grid.Row="0">
<Label Text="Uday" FontAttributes="Bold" FontSize="Large" HorizontalOptions="Center" VerticalOptions="EndAndExpand"/>
</StackLayout>
it works in my menubar.
use Grid.row="0"
When you set the background image to a smaller area as shown in the above code
Last edited by Prahlad; Mar 18th, 2020 at 08:44 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|