Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ListView,其中包含一个使用 RelativeLayout 的两个垂直方向的 TextView 左侧的图像。当两个 TextView 都有文本时,它看起来很好。有时底部的 TextView 不会有任何文本,问题是整个布局比应有的位置高几个像素,因为当没有任何使整个列表有烦人的空白时,它仍然为文本保留该空间差距。我记得看到一个例子,有人让布局不保留空间,但我不记得他是怎么做到的。有人可以启发我吗?
尝试更改底部文本的可见性。
当文本不存在时,请在此视图上执行setVisibility(View.INVISIBLE)或 setVisibility(View.GONE)。
我希望这会有所帮助。