0

根据我的网络服务中的对象,我在运行时创建了许多图像视图和文本视图。我正在水平创建linearLayout并将imageviews和textviews添加到布局中,现在的问题是文本与图像相对,并且图像的宽度不同,所以我想设置我的textviews的x位置,以便它们看起来都对齐如何做到这一点,

我尝试了absolutelayout(不推荐使用警告),setx(没有显示方法)

4

3 回答 3

0

I presume you mean this is a vertical LinearLayout, and each text/image combo is added below the previous one? In that case, you could have two LinearLayouts next to each other like two columns, adding the images to one and the text fields to the other. Then the widest image would stretch its layout to that width and all text fields would be just to the right of it.

于 2012-06-13T10:03:45.803 回答
0

您可以在运行时使用基于面板高度和宽度的调整大小的图像在运行时调整图像大小查看此堆栈溢出线程 调整图像大小 java getScaledInstance

于 2012-06-13T10:10:42.560 回答
0

weight在 ImageView 和 TextView 中使用属性

于 2012-06-13T12:14:12.847 回答