android setLayoutParams 问题,出错

             LinearLayout layt = (LinearLayout) rootView.findViewById(R.id.llt_2);
FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.gravity=Gravity.CENTER;
layt.setLayoutParams(layoutParams);

android setLayoutParams 问题,出错

关键:

主是要是在定义layoutParams的时候要用view的父容器类去声明,而它本身,

new FrameLayout.LayoutParams参数也一样要用父,

可参考:http://blog.csdn.net/greenappple/article/details/7631430
上一篇:JDBC增删改查和查唯一的完整代码


下一篇:如何让虚拟目录里面的webconfig不继承网站的设置