In Android Mini Program, the rendering parameter customization function of custom View is only supported in mPaaS 10.1.68.29 and later versions. If the current baseline version is lower than 10.1.68.29, please refer to mPaaS Upgrade Guide to upgrade the baseline version to 10.1.68.29.
Add custom rendering parameters in the tab of mini program
<mpaas-component
id="mpaas-map"
type="custom_map"
style="{{ width: 200, height: 200 }}"
color="#FFFF00FF"
···
/>
Note:
color
is a custom rendering parameter, which can be named arbitrarily. But the name of the custom rendering parameter cannot start with ‘on’, and the type cannot be func.id
,type
, andstyle
are the default fields, please do not use these fields as custom rendering parameters of custom views.
Receive and render custom rendering parameters
The client rewrites onReceivedRender
to receive the rendering parameters from the mini program, and calls Android View
to render the parameters.
public class MyTestEmbedView extends MPBaseEmbedView {
···
@Override
public void onReceivedRender(JSONObject jsonObject, H5BridgeContext h5BridgeContext) {
LoggerFactory.getTraceLogger().debug(TAG, "onReceivedRender: " + jsonObject.toString());
mRealView.render(jsonObject);
}
···
}