-2

I am trying to open an invisible activity when my main activity starts, and to change its visibility with a button. Invisible activity is a custom popup.

Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
  • https://stackoverflow.com/questions/2176922/how-do-i-create-a-transparent-activity-on-android – Akarsh M Jun 25 '19 at 08:01
  • `Invisible activity is a custom popup.` Have you considered creating a Dialog instead? At one point only 1 activity can be active. – Zun Jun 25 '19 at 11:06

1 Answers1

0

you can hide its visibility by setting visibility="gone/invisible"

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

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

<RelativeLayout
    android:visibility="gone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</RelativeLayout>

Rahul Singh
  • 320
  • 4
  • 7