@ Please, Hooda your solution did not solve my problem, but it really led me to the right way to find a solution.
What I had to do to fix this problem was to switch from a dynamically created TableRow to LinearLayout in my TableLayout. Then I was able to get the width of the screen and subtract my text images, and then set the width of the search string with the resulting number.
// gets the width of the screen to set the seekbar width Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); width = width - 170; LinearLayout lL = new LinearLayout(this); // creates the seekBar sBGauge = new SeekBar(this); sBGauge.setMax(depthL - 1); sBGauge.setId(2000 + i); sBGauge.setLayoutParams(new LinearLayout.LayoutParams(width, 50, 1f)); sBGauge.setOnSeekBarChangeListener(this);
source share