남자들 이미지를 특정 페이지의 배경으로 만들려고하는데 약간의 문제가 있습니다. 임 여기에 언급 된 임베디드 메서드를 통해 그것을하려고하는 : https://developer.xamarin.com/guides/xamarin-forms/user-interface/images/#Embedded_Images . 내가 응용 프로그램을 실행할 때 어떤 이유로, 그것은 충돌합니다. 'BackgroundImage ='line에서 뭔가 잘못되었다고 생각합니다. 내가 그 일을했을 때 나는 다소 짐작했습니다. 내가 그 라인을 주석 처리 할 때, 앱은 배경 이미지없이 잘로드됩니다. 나는 빌드 작업 = 컨텐츠를 사용하고 (이것은 많은 시행 착오 후에 나는 단지 모두 .Droid (당김)와 .iOS에 이미지를 추가하는 데 필요한, 작동 ... 설정과 같은 출력 디렉터리에 자원을임베디드 이미지 Xamarin Forms에서 C#
public class LoginPage : ContentPage
{
Entry emailBox = new Entry();
Entry passwordBox = new Entry();
Button createAccount = new Button();
Button forgotPassword = new Button();
StackLayout layout = new StackLayout();
Image embeddedImage = new Image { Source = ImageSource.FromResource("Charity.Properties.hands-426x640.jpg") };
public LoginPage()
{
Title = "Login";
BackgroundColor = Color.LightPink;
BackgroundImage = "Charity.Properties.hands-426x640.jpg";
emailBox.Placeholder = "email";
emailBox.BackgroundColor = Color.LightPink;
emailBox.PlaceholderColor = Color.HotPink;
passwordBox.Placeholder = "password";
passwordBox.BackgroundColor = Color.LightPink;
passwordBox.PlaceholderColor = Color.HotPink;
passwordBox.IsPassword = true;
createAccount.Text = "create an account";
createAccount.TextColor = Color.HotPink;
createAccount.Font = Font.SystemFontOfSize(NamedSize.Medium);
createAccount.BorderWidth = 0;
createAccount.HorizontalOptions = LayoutOptions.Center;
createAccount.VerticalOptions = LayoutOptions.CenterAndExpand;
forgotPassword.Text = "recover password";
forgotPassword.TextColor = Color.HotPink;
forgotPassword.Font = Font.SystemFontOfSize(NamedSize.Medium);
forgotPassword.BorderWidth = 0;
forgotPassword.HorizontalOptions = LayoutOptions.Center;
forgotPassword.VerticalOptions = LayoutOptions.CenterAndExpand;
layout.VerticalOptions = LayoutOptions.End;
layout.BackgroundColor = Color.LightPink;
layout.Children.Add(emailBox);
layout.Children.Add(passwordBox);
layout.Children.Add(createAccount);
layout.Children.Add(forgotPassword);
Content = layout;
}
}
포함 된 이미지에 사용한 경로를 살펴본 다음 배경에 사용했던 경로를 확인하십시오. 힌트 힌트. – Nkosi
확인 https://stackoverflow.com/questions/38949707/xamarin-forms-how-to-add-background-image-to-a-content-page – Nkosi
@Nkosi이 BackgroundImage = "Charity로 변경하려고했습니다. Properties.hands-426x640.jpg "; 하지만 앱이 실행되면 여전히 충돌합니다. 그 링크가 바로 xaml에 있습니까? 아직 xaml을 배울 필자는 아직까지 C#을 배웠다. –