我有一个图像视图和一个文本视图。文本视图位于图像视图下方。我需要在图像视图右侧显示文本视图。如何做?
LinearLayout ThelayoutL = new LinearLayout(getApplicationContext());
ThelayoutL.setOrientation(LinearLayout.VERTICAL);
ImageView TheItemImageL = new ImageView(mContextL);
TheItemImageL.setImageBitmap(ItemImageBytesListG.get(PositionP));
TheItemImageL.setScaleType(ImageView.ScaleType.FIT_XY);
TheItemImageL.setLayoutParams(new ListView.LayoutParams(100, 100));
TextView tvItemNameL = new TextView(mContextL);
tvItemNameL.setText(zItemNameListG.get(PositionP));
tvItemNameL.setGravity(Gravity.CENTER);
tvItemNameL.setTextSize(10);
tvItemNameL.setTextColor(Color.parseColor("#000000"));
答案 0 :(得分:1)
尝试ThelayoutL.setOrientation(LinearLayout.HORIZONTAL);
答案 1 :(得分:1)
替换
ThelayoutL.setOrientation(LinearLayout.VERTICAL);
到
ThelayoutL.setOrientation(LinearLayout.HORIZONTAL);
希望它有所帮助。