Skip to Content
0

SAPUI5 - add image/icon to radiobutton control (custom)

Nov 20, 2017 at 07:56 PM

152

avatar image

I need to show an image for every radio button in a radio button group.

I've seen a few examples of custom radiobuttons and radiobuttongroups, but none of them working.

Could someone please point me in the right direction?

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

2 Answers

Richard Zhao
Nov 23, 2017 at 06:22 AM
2

Hello, Adam Harkus. As far as I know the lasted version of UI5 1.48 radio button and radio button group still doesn't support this functionality. So I suggest that you should try to use radio button and button work together. Please check the code below, Hopefully, It will face your requirement.

<m:VBox >
	<m:HBox >
		<m:RadioButton groupName="GroupA" selected="true" />
		<m:Button icon="sap-icon://trend-up" iconFirst="true" width="auto" editable="false" enabled="true" visible="true" iconDensityAware="false" />    
	</m:HBox>
	<m:HBox >
		<m:RadioButton groupName="GroupA"  />
		<m:Button icon="sap-icon://filter"
			iconFirst="true" width="auto" enabled="true" visible="true"
				iconDensityAware="false" />	
	</m:HBox>
	<m:HBox >
		<m:RadioButton groupName="GroupA"  />
		<m:Button icon="sap-icon://add"
			iconFirst="true" width="auto" enabled="true" visible="true"
				iconDensityAware="false" />	
	</m:HBox>
</m:VBox>
Show 1 Share
10 |10000 characters needed characters left characters exceeded

This is what it looks like.

1511417201705.jpg (10.1 kB)
1
Iftah Peretz
Nov 23, 2017 at 06:50 AM
0

Hey Adam,

If all fails, you can always wrap it in a container/class/div etc. and edit the css of the radio buttons like so.

Share
10 |10000 characters needed characters left characters exceeded