0

Let say that I have an layout in res/values named layout1.xml.

In this layout I have only one linear layout (the black one on the picture)

The thing I want to do is to add an array of linear layouts just like on the picture. The red ones are linearlayout with horizontal orientation that contains 5 other linear layouts. I want to do everything in code and I want to set an onclick listener to each of the layouts so when one is clicked I want to hide it. Everything needs to be putted in a function that will return a Layout and the this method should take prams for the rows and cols

public LinearLayout getLayout(int rows,int cols){
       return the_layout;
}

enter image description here

Lukap
  • 31,523
  • 64
  • 157
  • 244

1 Answers1

0

You make a LinearLayout with the constructor new LinearLayout(context)

You add layouts with parentLayout.addView(childLayout).

You should be able to do the rest.

AJcodez
  • 31,780
  • 20
  • 84
  • 118