title: Programmatically set view width
body: <p>I am developing an android app. There are six main <code>long</code> variables that are displayed on-screen at any time. These are continually incremented using a timer on a separate thread. The user can watch these variables increase on screen. Each of these variables has a maximum amount.</p>
  
  <p>What I'd like to do is draw a 'progress bar' for each of these variables. At the moment, I am using a <code>View</code> with a solid red colour.</p>
  
  <p>Please see below for prototype:</p>
  
  <p><img src="https://i.stack.imgur.com/RMMw6.png" alt="enter image description here"></p>
  
  <p>The red bar on the left would represent a variable that has reached it's maximum amount, whilst the others are empty and the bar has a width of 0, so is invisible. Each variable is placed in a <code>RelativeLayout</code> (which represents one 'section'), which is then placed in a <code>LinearLayout</code>. At a future point I may need to add/remove some - so the solution needs to not rely on hard-coded layout positionings.</p>
  
  <p>My question is how can I programmaticaly set the width of these 'progress bar's in code, whilst not hard-coding the layout co-ordinates of any of the variables?</p>