用白色图像隐藏Android Studio中的所有textView

凯文:

我试图用白色图像隐藏屏幕的所有内容10秒钟,但是无论如何似乎文本都显示在白色图像的顶部。有没有一种方法可以使用白色图像隐藏textView(或将来的任何其他imageViews)?谢谢!

这是我的主要活动课:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
     final ImageView splash = findViewById(R.id.imageView);
    splash.setScaleType(ImageView.ScaleType.FIT_XY);
    splash.postDelayed(new Runnable() {
        @Override
        public void run() {
            splash.setVisibility(View.GONE);
        }
    }, 10000);
}}

这是我的XML文件:

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    android:textSize="24sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.544"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/white" />

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="172dp"
    android:layout_marginTop="268dp"
    android:text="TextToHide"
    android:textSize="36sp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

在此处输入图片说明

在此处输入图片说明

我知道 :

如果要ImageView启用,TextView必须先添加到XML,TextView然后ImageView这样:

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    android:textSize="24sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.544"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />


<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="172dp"
    android:layout_marginTop="268dp"
    android:text="TextToHide"
    android:textSize="36sp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/white" />

现在你TextView将落后ImageView

我不知道您要做什么,但我认为将TextView可见性设置GONEINVISIBLE放置ImageView要隐藏的内容会更容易

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在TextView的内容没有显示(Android Studio中)

无法从Android Studio中的Firebase获得所有价值

在Android Studio中运行所有单元测试

如何查看Android Studio中的所有TODO任务?

用白色背景替换PNG图像中的透明度

Android Studio在目录中包含所有aar文件

使用PDF或Vector文件在Android Studio中添加所有大小的图像资产

显示Android Studio中的所有标签

在Android Studio中显示所有可绘制内容

在Android Studio GUI中显示所有有冲突的文件

Android Studio中可用的所有评论标签是什么?

ImageView显示白色图像Android Studio Kotlin

所有插件未在android studio中显示

有什么方法可以用白色填充图像的内部吗?

用纯白色填充图像蒙版中的数字

如何在TextView Android中获取所有活动的跨度链接

获取Android Studio中表格布局中的所有按钮

如何在Android中为圆形图像获取白色边框?

Android检测图像上是否有白色并显示吐司

如何在Android的ListView中获取所有TextView值?

无法在Android Studio中查看所有.jar代码

Android在所有项目中在recyclerview中更改textview而无需重绘整个列表

在Android Studio中更新textView

如何使用appium获取android.widget.TextView中列出的所有选项卡元素?

所有代码均已从Android Studio中删除

Android ArrayList并未列出TextView中的所有元素

从android studio中的sql删除所有行

如何在android中对齐所有TextView?

Flutter,在 android studio 中运行所有测试