1

TableLayoutXML を内 内 でLinearLayout膨らませたいと思いますScrollView

これは私のmain.xmlです:

<ScrollView..>
  <LinearLayout>
    <TableLayout>
    </TableLayout>
  </LinearLayout>
</ScrollView>

これはtabletoinflate.xmlを膨らませるための私のxmlです

<TableLayout>
</TableLayout>


tl1 = (TableLayout)getView().findViewById(R.id.tableLayout1); //this exists in the onCreate

//このメソッドは膨張するはずですが、機能していません

void myMethodToInflate()
{
    LayoutInflater inflater =(LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.tabletoinflate, null;
        initializeTogglesPost(view);
        tl1.removeAllViews();
        tl1.addView(view);
}

//このメソッドは、TableLayout 内の 24 個のトグル ボタンを初期化して膨張させます。

private void initializeTogglesPost(View viewPost)
{   
    toggleButtonsPost = new ToggleButton[24];
    for(int i = 0;i<24;i++)
    {
        toggleButtonsPost[i] = (ToggleButton)viewPost.findViewWithTag((String) ((i+1) + ""));
        toggleButtonsPost[i].setOnClickListener(this);
    }

}
4

0 に答える 0