带weightSum的线性布局和三种布局

Linearlayout with weightSum and three layouts

下面是我在 listview.The 中使用的布局项目 问题是,当我在列表的某些项目中看到 countlayout 时,我希望 vibelayout 与 countlayout 所在的位置完全相同,因为 weigtSum 是3.But 它出现在 countlayout 所在位置的右侧。

我正在使用 View.GONE 以便将 countlayout space 分配给 vibelayout 但它没有发生.. vibelayout 出现在 countlayout 所在位置的右侧。

尝试在所有 3 种布局中使用 android:layout_width="0dp"。它会解决你的问题