我正在向ScrollView添加LinearLayout,但LinearLayout不会显示。这似乎是一个相当直接的事情,所以我无法理解这里的问题。
ScrollView scroll = new ScrollView(this);
FrameLayout.LayoutParams params=new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
scroll.setLayoutParams(params);
scroll.setBackgroundResource(R.color.white);
LinearLayout layout=new LinearLayout(this);
layout.setLayoutParams(new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
layout.setBackgroundResource(R.color.black);
scroll.addView(layout);
optionsWorkerLayout.addView(scroll);