kamilws
kamilws

Reputation: 171

Xamarin horizontal view with buttons

any ideas how to prepare such an element as at the picture ? I need 5 buttons to be there so i could swipe through them but only 3 one them are visible all the time. I need this to work on android and ios in xamarin forms.

enter image description here

Upvotes: 1

Views: 968

Answers (1)

Krishna
Krishna

Reputation: 1985

Try this Add ScrollView and set it's orientation to horizontal

ScrollView = new ScrollView
{
    Orientation = ScrollOrientation.Horizontal
};

//ScrollView.Scrolled += ScrollView_Scrolled;

ItemsStackLayout = new StackLayout
{
    Orientation = StackOrientation.Horizontal,
    Padding = new Thickness(0),
    Spacing = 0,
    HorizontalOptions = LayoutOptions.FillAndExpand
};

ScrollView.Content = ItemsStackLayout;

you can set the width of the elements inside 1/3 of the view width

FYI I use the same in my app I use the same in my App

Upvotes: 3

Related Questions