是否可以通过编程方式对GridLayout进行row_span操作?

时间:2014-12-18 01:50:42

标签: android android-layout android-activity android-fragments android-view

我想在GridLayout上进行row_span操作,并在该跨区域添加一个按钮。视图应覆盖整个区域。但我无法实现我的目标。有谁可以帮助我?

这是我的代码

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.schedule);
    g =(GridLayout)findViewById(R.id.grid);

    Button b = new Button(this);
    GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
    layoutParams.rowSpec = GridLayout.spec(3,5,112);
    g.addView(b,layoutParams);
}

0 个答案:

没有答案