Skip to Content
0

How to display 4 images in a carousel at one time

Oct 09, 2017 at 10:38 AM

42

avatar image
Former Member

Suppose i have 8 images i need to display 4 at a time in the carousel and others when i press the button how should i do that i tried doing it but it only displays one image at a time can someone please guide me on this thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Vedaradhya Agrahar Oct 09, 2017 at 11:38 AM
0

Hi Yadnesh,

you can achieve this by using Grid layout. here sample code

first define layout lib name space in xml view xmlns:l="sap.ui.layout"

 <Carousel class="sapUiContentPadding" loop="true">
		<pages>
			<l:Grid defaultSpan="L6 M6 S12" vSpacing="0.5" hSpacing="0.5">
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
			</l:Grid>
			<l:Grid defaultSpan="L6 M6 S12" vSpacing="0.5" hSpacing="0.5">
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
				<Image src="Image Source Path" height="300px" width="100%"/>
			</l:Grid>
		</pages>
	</Carousel>

Regards,

Vedaradhya.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Can i make the carousel load one image at a time instead of loading all the rest 4 images when i press the button

0
Sharath M G Oct 10, 2017 at 07:18 AM
0

If you want to load one image at a time, then do not set the source path in design time. At runtime, on click, set the source path of the image control. At each click, choose the path(store it in an array) and load them one by one.

Regards,

Sharath

Share
10 |10000 characters needed characters left characters exceeded