Forum Xamarin.Forms

Fullscreen CarouselPage with background image and overlayed scrollable text

xceedxceed GBMember ✭✭
edited October 2014 in Xamarin.Forms

Hi guys, I'm trying to get a Xamarin Forms CarouselPage based app working, but I'm not sure if what I'm trying to do is actually possible, I've run into a couple difficulties.

So far I can get the carousel working with the code shown below. I can then swipe between each image and this behaves as expected.

    public class App
    {
        public static Page GetMainPage()
        {
            return new CarouselPage {
                  Children = {
                    new ContentPage {Content = new Image {Source = "image1.png"}},
                    new ContentPage {Content = new Image {Source = "image2.png"}},
                    new ContentPage {Content = new Image {Source = "image3.png"}},
                  }
            };
        }
    }

What I'd like to do next is have the image completely fullscreen (and landscape), the images are the correct size so will fill the screen correctly.

The following code works as expected on another app I have that is android only and NOT using Xamarin Forms:

[Activity(Label = "MyApp1", MainLauncher = true, Icon = "@drawable/icon", ScreenOrientation = Android.Content.PM.ScreenOrientation.Landscape, Theme = "@android:style/Theme.NoTitleBar.Fullscreen")]

When I try this in the MainActivity for my app using Xamarin Forms, there's a nullpointer exception and the carousel page isn't displayed correctly, I can hide the action bar using

ActionBar.Hide();

but this only gets me half way as the title bar is hidden but I can still see the status bar with the Wi-Fi/battery icons.

Is there something I need to code in my App.cs file to achieve this rather than the MainActivty?

The next thing I wasn't sure about is how I would then overlay some scrollable text on top of each of the images, that changes after each swipe. It'd be perfect if the overlayed text had a transparent background so you could still see the image behind.

Any ideas?

Thanks

Posts

  • xceedxceed GBMember ✭✭
    edited October 2014

    I managed to the get the app running fullscreen with the following code:

    Window.AddFlags(WindowManagerFlags.Fullscreen);

    I don't need to bother with ActionBar.Hide(); now.

    Does anyone have any advice, even just general, about how to go about adding a transparent layer that contains text (and is scrollable) on top of the image? Perhaps I need to try setting a background image rather than setting the content for each carouselpage's contentpage as just an Image.

    Thanks

Sign In or Register to comment.