Skip to Content
avatar image
Former Member

How to display 4 images in a carousel at one time

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 09, 2017 at 11:38 AM

    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.

    Add comment
    10|10000 characters needed 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

  • Oct 10, 2017 at 07:18 AM

    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

    Add comment
    10|10000 characters needed characters exceeded