标签:
1 LinearLayout layt = (LinearLayout) rootView.findViewById(R.id.llt_2); 2 FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); 3 layoutParams.gravity=Gravity.CENTER; 4 layt.setLayoutParams(layoutParams);
关键:
主是要是在定义layoutParams的时候要用view的父容器类去声明,而它本身,
new FrameLayout.LayoutParams参数也一样要用父,
可参考:http://blog.csdn.net/greenappple/article/details/7631430
标签:
原文地址:http://www.cnblogs.com/jenson138/p/4242795.html