Dynamically add textViews to a linearLayout

后端 未结 6 1343
孤独总比滥情好
孤独总比滥情好 2020-11-29 00:23

I read this somewhere here and I totally lost it, but could use some assistance.

My app is pulling the column names from sqlite into an array. I want to create a tex

6条回答
  •  遥遥无期
    2020-11-29 01:13

    I think this will be useful:

    int j = 0;
    
    context.getSystemService(Context.WINDOW_SERVICE);
    WindowManager manager = (WindowManager) context
                            .getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    
    for (int i = 0; i < tabsize; i++) {
        Tab tab = tabSet.get(i);
        if (i == selectedTabId)
            tab.setSelected(true);
        View view = tab.getView();
    
        TableRow.LayoutParams pCol = new TableRow.LayoutParams();
        pCol.width = display.getWidth() / tabSet.size();
    
        rowBottom.addView(view, pCol);
    }
    

提交回复
热议问题