How to place text of an button in center
<p>In my array of buttons i want to place the text of each button to be placed in center.I have use Gravity but it doesnt work. The code i have use is.Please anyone help me to solve this out.</p>

<pre><code>    LinearLayout layoutVertical = (LinearLayout) findViewById(R.id.liVLayout);
    LinearLayout rowLayout = null;

    LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1);

    //Create Button
    for (int i = 0; i&lt;6; i++)
    {
        rowLayout = new LinearLayout(this);
        rowLayout.setWeightSum(7);
        layoutVertical.addView(rowLayout, param);   

        for(int j=0; j&lt;7; j++)
        {
            m_pBtnDay[i][j] = new Button(this);             

            m_pBtnDay[i][j].setTextSize(12);
            m_pBtnDay[i][j].setGravity(Gravity.CENTER);

            rowLayout.addView(m_pBtnDay[i][j], param); 

            m_pBtnDay[i][j].setOnLongClickListener(this);                           
            m_pBtnDay[i][j].setOnClickListener(this);

            m_pBtnDay[i][j].setOnTouchListener(this);              

            //save button position
            m_pBtnDay[i][j].setTag(new CalendarForm(i , j));
        }
    }
</code></pre>
