Android开发

Android开发LayoutParams

2022-07-19  本文已影响0人  你的益达233

LayoutParams

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            lp.leftMargin = Utils.dip2px(mContext, 12);
            clRecommend.setLayoutParams(lp);

MarginLayoutParams

val mainLayoutParams = mBinding.clMainMsg.layoutParams as ViewGroup.MarginLayoutParams
    mainLayoutParams.topMargin = StatusBarUtils.getStatusBarHeight(activity)
    mBinding.clMainMsg.layoutParams = mainLayoutParams
上一篇 下一篇

猜你喜欢

热点阅读