我是Android新手。请问如何在Android中以编程方式更改布局的RootView
高度?下面是我尝试过的代码:
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.sample, null);
view.getRootView().getLayoutParams().height = value;
执行此操作后,我在上面的代码行上收到一个空指针异常。 有人能帮帮我吗?提前感谢。