Visibility属性にはinvisibleとgoneの違いがあります.

2092 ワード

http://developer.android.com/reference/android/view/View.html#attr_android:visibility
以下はAndroid Developersで、それらの違いを紹介します.
android:visibility
Controls the initial visibility of the view.
Must be one of the follwing constant values.
コンサート
Value
Descriptionvisible0
Visible on screenthe default value.invisible1
Not displayed、but taken into account during layout(space is left for it)gone2
Copletely hidden、as if the view had not been added.
This corespins to the global atribute resource smbol  visibility.
Related Methods
  • set Visibility(int)
  • goneは完全に隠しています.InVisibleは見えませんが、コントロールの空間占有は依然として存在します.
    
        
          
         
         
        
          
          
    上のコードで右側のような効果が見られます.