本文整理汇总了Java中com.taobao.weex.utils.WXViewUtils.getScreenWidth方法的典型用法代码示例。如果您正苦于以下问题:Java WXViewUtils.getScreenWidth方法的具体用法?Java WXViewUtils.getScreenWidth怎么用?Java WXViewUtils.getScreenWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.weex.utils.WXViewUtils
的用法示例。
在下文中一共展示了WXViewUtils.getScreenWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: measure
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
protected MeasureOutput measure(int width, int height) {
MeasureOutput measureOutput = new MeasureOutput();
if (this.mOrientation == Constants.Orientation.HORIZONTAL) {
int screenW = WXViewUtils.getScreenWidth(WXEnvironment.sApplication);
int weexW = WXViewUtils.getWeexWidth(getInstanceId());
measureOutput.width = width > (weexW >= screenW ? screenW : weexW) ? FrameLayout.LayoutParams.MATCH_PARENT
: width;
measureOutput.height = height;
} else {
int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
int weexH = WXViewUtils.getWeexHeight(getInstanceId());
measureOutput.height = height > (weexH >= screenH ? screenH : weexH) ? FrameLayout.LayoutParams.MATCH_PARENT
: height;
measureOutput.width = width;
}
return measureOutput;
}
示例2: WXSvgContainer
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public WXSvgContainer(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) {
super(instance, dom, parent);
mDom = dom;
Log.v("WXSvgContainer", mDom.getAttrs().values().toString());
if (mDom.getStyles().get(Constants.Name.HEIGHT) == null) {
mDom.getStyles().put(Constants.Name.HEIGHT, "0");
}
if (mDom.getStyles().get(Constants.Name.WIDTH) == null) {
mDom.getStyles().put(Constants.Name.WIDTH, "0");
}
mScale = (float) (WXViewUtils.getScreenWidth(parent.getContext()) * 1.0 / dom.getViewPortWidth());
}
示例3: setData
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public void setData(UWXTheme.NavBar navBar) {
// float weexPxByReal = WXViewUtils.getWeexPxByReal(navBar.height)/2;
LayoutParams layoutParams = new LayoutParams(WXViewUtils.getScreenWidth(getContext()),
DensityUtil.dip2px(getContext(), navBar.height / 2 - 5));
this.setLayoutParams(layoutParams);
this.textBack.setVisibility(navBar.hasBack ? VISIBLE : GONE);
try {
this.setBackgroundColor(Color.parseColor(navBar.navBarColor));
this.textBack.setTextColor(Color.parseColor(navBar.backColor));
} catch (IllegalArgumentException e) {
UWLog.e(e.getMessage());
}
}
示例4: WXSvgAbsComponent
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public WXSvgAbsComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) {
super(instance, dom, parent);
mScale = (float) (WXViewUtils.getScreenWidth(parent.getContext()) * 1.0 / dom.getViewPortWidth());
}