我正在尝试获取heightPercent
属性值以实现我尝试了以下代码但不起作用:
代码
PercentRelativeLayout mPercentRelativeLayout = new PercentRelativeLayout(getActivity());
mPercentRelativeLayout = (PercentRelativeLayout) view.findViewById(R.id.percentRelativeLayout);
PercentRelativeLayout.LayoutParams layoutParams = new PercentRelativeLayout.LayoutParams(mPercentRelativeLayout.getLayoutParams());
Log.v("PercentRL Height :", "" + layoutParams.getPercentLayoutInfo().heightPercent);
输出
PercentRL Height :﹕ -1
我将不胜感激任何帮助。