使按钮不可见并声明 space

make button invisible and claim space

是否可以使按钮不可见并声称可用space?

我有三个水平按钮。在启动时,它会决定三个按钮中的哪一个应该可见,但如果中间的按钮不可见而外面的两个按钮不可见,它会在它们之间留下一个 space,对应于不存在的按钮的大小

我希望能够将两个外侧按钮移动到挤入和居中

任何想法

马克

将此按钮的可见性设置为 View.GONE。 来自文档:

public static final int GONE

Added in API level 1
This view is invisible, and it doesn't take any space for layout purposes. Use with setVisibility(int) and android:visibility.

使用View.GONE.

public static final int GONE

Added in API level 1
This view is invisible, and it doesn't take any space for layout purposes. Use with setVisibility(int) and android:visibility.

http://developer.android.com/reference/android/view/View.html#GONE