它没有给我任何东西..在我错过任何东西的地方,任何人都可以帮助我整理它,而不是显示图像以及我添加到相对布局中的文本视图
RelativeLayout.LayoutParams tParams = new RelativeLayout.LayoutParams
(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
tParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
tParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
LayoutParams rlParams = new LayoutParams(LayoutParams.FILL_PARENT
,LayoutParams.FILL_PARENT);
for (int i=0; i < Math.ceil(MyContants.servicemodellist.size() / 2); i++) {
TextView txt= new TextView(RoomservicsFirstPage.this);
txt.setText(MyContants.servicemodellist.get(i).getOption_text_1());
RelativeLayout rLayout = new RelativeLayout(RoomservicsFirstPage.this);
txt.setLayoutParams(tParams);
rLayout.setLayoutParams(rlParams);
// Adding the TextView to the RelativeLayout as a child
ImageView image = new ImageView(RoomservicsFirstPage.this);
image.setLayoutParams(rlParams);
download(MyContants.servicemodellist.get(i).getImage(),image);
rLayout.addView(image);
rLayout.addView(txt);
rows.addView(rLayout);
}
我解决了我的问题..在拖曳中添加布局时我没有添加布局参数:)