Мне нужно разделить однолинейную компоновку на две колонки (Как столбцы газеты). Линейный макет содержит текстовый вид и образ-просмотр
Я взял ширину экрана и разделил ее на половину и сделал TextView
и ImageView
для входа в первый столбец, т.е. A B C
блоков на рисунке ниже. Теперь оставшиеся TextView
и 'ImageView
должен перейти в следующий столбец, например, в D E F
, как это происходит. Поэтому было бы полезно, если бы кто-нибудь дал мне какой-либо код или идеи для его реализации. Я пробовал с GridView
, который не подходит для моей проблемы. Поскольку размеры TextView
и ImageView
не определены.
Я не знаю, как разделить макет Liner. Я попытался рассчитать высоту rootlayout как это
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();
}
}
});
Снимок экрана