Ich bekomme Laufzeit dynamische ImageButton angezeigt, aber ich habe einige Dinge, die auf dem Bildschirm angezeigt werden, so jetzt, wenn ich meine Runtime ImageButton hinzufügen wird es die vorherige statische Anzeige überlappen und ich möchte die Laufzeit hinzufügen imagebutton nach dem statischen Layout, das durch xml kommt. bitte hilfe.Verwalten Layout-Laufzeit Android
for (int i =0;i<adapt_objmenu.image_array.length;i++){
ImageButton b1 = new ImageButton(myrefmenu);
b1.setId(100 + i);
b1.setImageResource(R.drawable.bullet_1);
// b1.setPadding(left, top, right, bottom)
b1.setPadding(0, 10, 0, 10);
b1.setBackgroundColor(R.drawable.bg_navitionbar);
// b1.setText(adapt_objmenu.city_name_array[i]);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (i > 0) {
lp.addRule(RelativeLayout.RIGHT_OF, b1.getId() - 1);
}
b1.setLayoutParams(lp);
relative.addView(b1);
//relate.addView(b1, i, new RelativeLayout.LayoutParams(width,height));
//height = height+80;
}
Ich benutze die gleiche Sache \ – Ved
Was die Ausrichtung des Linearlayout ist? –
siehe Ich hatte den Code bearbeitet – Ved