1.配置自定义组件
public class MyViewComponent extends WXComponent{ public MyViewComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent, String instanceId, boolean lazy) { super(instance, node, parent, instanceId, lazy); } @Override protected void initView() { //TODO:your own code …… } @Override public WXFrameLayout getView() { //TODO:your own code ……… } @WXComponentProp(name=WXDomPropConstant.WX_ATTR_VALUE) public void setMyViewValue(String value) { ((TextView)mHost).setText(value); } }
2.注册组件
WXSDKEngine.registerComponent("MyView", MyViewComponent.class);
时间: 2024-10-27 13:59:51