android-layout - Android SDK 中的常量

标签 android-layout

当使用 setVisibility(int) 时,int 可以是 VISIBLE、INVISIBLE 和 GONE 这些,当我查找它们时,(显然)设置了 int 值。 但是,我不能只输入(比如)“GONE”,因为它无法被识别。 我如何导入定义,还是必须在我自己的代码中定义它们?

最佳答案

只需将 import static android.view.View.GONE 放在您的导入下方,您就可以直接使用 GONE 常量,而无需任何额外的限定符。

关于android-layout - Android SDK 中的常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4955286/

相关文章:

android - 禁用 TextInputEditText 时禁用密码切换 ImageButton

java - 如何在 TabHost 中为两个不同的选项卡显示相同的布局?

android - ConstraintLayout TextView

android - "colorPrimary"和 "android:colorPrimary"的 attr 有什么区别?

android - GridLayout LayoutParams - 以编程方式应用权重和跨度

android - 如何在android中自动增加动态创建的TextView的高度?

android - 如何添加一个开关到android操作栏?

java - 应用程序崩溃: Android Studio: Switching Activities Using If Statements (INTENT)

android - 在 Android 上动态显示/隐藏多个 OpenGL View

android - 如何将自定义 ActionBar 设置为 ScrollView 布局中的固定顶部位置?