Я написал код ниже, но кнопка не отображается, потому что я установил FILL_PARENT на панели layoutParametrs. Как я мог это исправить, не используя XML?
TableRow myLayout = new TableRow (this);
myLayout.setAlwaysDrawnWithCacheEnabled(true);
TextView text = new TextView (this);
text.setText("Test: ");
SeekBar bar = new SeekBar (this);
ToggleButton button = new ToggleButton (this);
myLayout.addView( text , new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
myLayout.addView( bar , new TableRow.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
myLayout.addView( button , new TableRow.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
Если FILL_PARENT установлен для бара
Если нет
оба варианта неверны