Reputation: 852
I am making a overlay on the screen just like facebook messenger, the overlay is working but it is showing only the textview present in the layout but it is not showing the images in the same layout
I have tried rebuilding the project, cleaning it but it doesnt seem to fix the issue
windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
val params = WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.OPAQUE)
//Inflate the chat head layout we created
val visitorAlertView = LayoutInflater.from(this).inflate(R.layout.overlay_visitor_alert, null)
windowManager.addView(visitorAlertView, params)
it should appear like this, but it is not showing only the images
here is my layout xml file
<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:id="@+id/root_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<RelativeLayout
android:id="@+id/collapse_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="@color/colorPrimary"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:text="Naveen"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/visitor_name" android:textAlignment="center"
android:textColor="#fff" android:fontFamily="@font/ubuntu" android:textSize="30dp"
android:layout_marginTop="147dp" android:layout_alignParentEnd="true" android:layout_marginEnd="0dp"
android:layout_alignParentStart="true" android:layout_marginStart="0dp"
android:layout_marginBottom="-57dp" android:layout_alignTop="@+id/imageView7" android:gravity="center"/>
<TextView
android:text="@string/app_name_short"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/textView11" android:textAlignment="center"
android:textColor="#fff" android:fontFamily="@font/ubuntu" android:textSize="50dp"
android:layout_marginTop="100dp" android:layout_alignParentEnd="true" android:layout_marginEnd="0dp"
android:layout_alignParentStart="true" android:layout_marginStart="0dp"/>
<TextView
android:text="@string/overlay_visitor_alert"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/textView12"
android:layout_below="@+id/textView11" android:textColor="#fff" android:textAlignment="center"
android:layout_alignParentStart="true" android:layout_marginStart="0dp"
android:layout_alignParentEnd="true" android:layout_marginEnd="0dp"/>
<ImageView
android:layout_width="149dp"
android:layout_height="108dp" app:srcCompat="@drawable/user_round_icon"
android:id="@+id/imageView7"
android:layout_below="@+id/textView12"
android:layout_alignEnd="@+id/textView12"
android:layout_alignParentStart="true"
android:foregroundGravity="center_horizontal" android:layout_marginTop="32dp"
android:layout_marginStart="0dp" android:layout_marginEnd="0dp"/>
<ImageView
android:layout_width="96dp"
android:layout_height="96dp" app:srcCompat="@drawable/overlay_accept"
android:id="@+id/visitor_accept" android:layout_alignTop="@+id/visitor_name"
android:layout_marginTop="100dp" android:layout_alignParentStart="true"
android:layout_marginStart="45dp"/>
<ImageView
android:layout_width="96dp"
android:layout_height="96dp" app:srcCompat="@drawable/overlay_cancel"
android:id="@+id/imageView9" android:layout_alignTop="@+id/visitor_name"
android:layout_marginTop="100dp" android:layout_toEndOf="@+id/visitor_accept"
android:layout_marginStart="100dp"/>
</RelativeLayout>
</RelativeLayout>
Upvotes: 0
Views: 648