title: Android Edit text alignment
body: <p>I am making a small app for a tablet, something like a display sign. </p>
  
  <p>I have a few text elements that are center aligned in the display sign. When I tap on it, it gets converted to editText. I want the edit text in such a way that the text in it is center aligned and content wrapped. But when i input something, editText expands both ways, keeping the text aligned to the center. I want to do the same thing with right aligned text elements (only difference is that the edit text would expand only towards the left).</p>
  
  <p>When i am trying to do this right now it expands towards the left.This is my code for laying out the edit Text element</p>
  
  <pre><code>tempView=new EditText(this);
  ((EditText) tempView).setTextSize(shrinkedFontSize);
  ((EditText) tempView).setTypeface(tf);
  ((EditText) tempView).setText(tempInput.getText());     
  ((EditText) tempView).setGravity(Gravity.CENTER);
  layout.addView(tempView, tempParams);
  </code></pre>
  
  <p>I am setting the width of the layout as Wrap_content in the layout parameters. I have also specified the x and y in my layout parameters for the top left corner of the edit text. </p>
  
  <p>Is there any way to achieve this ?</p>