Weex has wrapped up the most critical platform components, such as ScrollView
, ListView
, Text
, Imageview
and so on. Certainly these components can not completely meet your need. And thousands of native UI components that always be using in our project may be required to integrate into Weex easily. Fortunately, it's quite convenient to wrap up your own components that should be from any existing components.
WXComponent
or WXContainer
;
package com.taobao.weex.ui.component;
……
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);
}
}
WXSDKEngine.registerComponent("MyView", MyViewComponent.class);