Android 更改表格布局中的重力标题

Android 更改表格布局中的重力标题,android,android-tablelayout,gravity,Android,Android Tablelayout,Gravity,我有这个 public void header(int recursocabecera) { TableRow.LayoutParams layoutCelda; TableRow fila = new TableRow(actividad); TableRow.LayoutParams layoutFila = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)

我有这个

 public void header(int recursocabecera)
{
    TableRow.LayoutParams layoutCelda;
    TableRow fila = new TableRow(actividad);
    TableRow.LayoutParams layoutFila = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    fila.setLayoutParams(layoutFila);

    String[] arraycabecera = rs.getStringArray(recursocabecera);
    COLUMNAS = arraycabecera.length;

    for(int i = 0; i < arraycabecera.length; i++)
    {
        TextView texto = new TextView(actividad);
       // layoutCelda = new TableRow.LayoutParams(obtenerAncho(arraycabecera[i]), LayoutParams.FILL_PARENT);
       layoutCelda = new TableRow.LayoutParams(obtenerAnchoPixelesTexto(arraycabecera[i]), LayoutParams.FILL_PARENT);
     //   layoutCelda= new LayoutParams(100, ViewGroup.LayoutParams.FILL_PARENT);
        texto.setSingleLine(true);
        texto.setText(arraycabecera[i]);
        texto.setGravity(Gravity.CENTER_HORIZONTAL);
        texto.setRotation(-90);
        texto.setTextAppearance(actividad, R.style.estilo_celda2);
        texto.setBackgroundResource(R.drawable.tabla_celda_cabecera2);
        texto.setLayoutParams(layoutCelda);
        texto.setPadding(20,0,0,100);
        layoutCelda.setMargins(0,0,60,0);
        layoutCelda.setMarginEnd(90);

        fila.addView(texto);
    }

    tabla.addView(fila);
    filas.add(fila);

    FILAS++;
}
public void头(int recursera)
{
TableRow.LayoutParams layoutCelda;
TableRow fila=新的TableRow(活动数据);
TableRow.LayoutParams layoutFila=新建TableRow.LayoutParams(LayoutParams.WRAP_内容,LayoutParams.WRAP_内容);
fila.setLayoutParams(layoutFila);
String[]arraycabecera=rs.getStringArray(递归);
COLUMNAS=arraycabecera.length;
for(int i=0;i
结果就是这样

但我需要像这样的东西

setGravity它工作一半,但标题显示为裁剪

我的结果是:


您能显示错误图像吗?我在帖子中添加了它。谢谢你能显示错误图片吗?我在我的帖子中添加了它。谢谢