Программно добавляющий TableRow к TableLayout, не работающему

я пытаюсь добавить строки таблицы программно после кода здесь

    /* Find Tablelayout defined in main.xml */
    TableLayout tl = (TableLayout) findViewById(R.id.SaleOrderLines);
    /* Create a new row to be added. */
    TableRow tr = new TableRow(this);
    tr.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    /* Create a Button to be the row-content. */
    Button b = new Button(this);
    b.setText("Dynamic Button");
    b.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    /* Add Button to row. */
    tr.addView(b);
    /* Add row to TableLayout. */
    //tr.setBackgroundResource(R.drawable.sf_gradient_03);
    tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

, Но но ничто не оттянуто на экран. (то же как каждый упомянул здесь )

, Когда я добавил tr.setBackgroundResource (R.drawable.sf_gradient_03); , строка с фоновым изображением оттянута, но не кнопка

Вот мое Расположение



    
        
    
    
        
            
            
            
        
        
            
            
            
             
        
    
    
        

45
задан Community 23 May 2017 в 12:09
поделиться