Problem of Positioning Buttons in Android Studio dynamically created

0

I have a database and based on this I create buttons with a name, but I can not find a method that puts one button under another.  I know it can be done in the .xml with the layout_below="" but dynamically I do not see a method to position them one below the other.

public void completaVista()
{
    SQLiteDatabase db = this.mBD.getReadableDatabase();
    Cursor c = db.rawQuery("SELECT * FROM "+ManejadorBaseDatos.DatosTabla1.NOMBRE_TABLA,null);
    while (c.moveToNext())
    {
        ScrollView svMaterias = (ScrollView) findViewById(R.id.svMaterias);
        RelativeLayout rlNuevo = recuadroMateria(c.getString(0)); // me devuelve un Relative Layout con cosas adentro
        svMaterias.addView(rlNuevo);
        ImageButton ibAgrega = (ImageButton) findViewById(R.id.btnNewSubject);
        //Algun procedimiento para que ibAgrega este debajo de rlNuevo
    }
}
    
asked by Franco Rolando 12.11.2018 в 02:37
source

1 answer

1

Create a TextView number according to elements of an array

This link was the solution to the question! Adapting it to buttons

    
answered by 12.11.2018 / 21:42
source