I have to split a Single Linear layout into a Two Columns(Like newspaper Columns).The linear layout contain text-view and image-view
I have taken the screen width and have divided it to half and made the TextView
and ImageView
to come in a first column , ie, A B C
blocks in the picture below.. now the remaining TextView
and 'ImageView
has to go to next column like in D E F
like that it goes on.So it would be helpful if anyone gives me any code or ideas to implement this.. I tried with GridView
which is not suitable for my issue. Since the TextView
and ImageView
sizes are not definite.
I don't know how to split Liner layout. I tried with calculating the rootlayout height like this
linearLayout.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
int linsize=linearLayout.getHeight();
int relsize=root.getHeight();
int textsize=txt1.getHeight();
mainheight=relsize;
subheight=linsize;
Toast.makeText(getApplicationContext(), "Linerlayout "+linsize, Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), "Relative layout"+relsize, Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), "text height "+textsize, Toast.LENGTH_LONG).show();
if(mainheight==subheight)
{
Toast.makeText(getApplicationContext(), "make a new linear layout", Toast.LENGTH_LONG).show();
createsubview();
}
}
});
Screenshot