1

我正在尝试获取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

我将不胜感激任何帮助。

4

0 回答 0