简体   繁体   English

触摸问题总是在最前面

[英]Touch issue on always on top

I've created a transparent activity with some UI while to show on incoming call.我创建了一个带有一些 UI 的透明活动,同时在来电时显示。 It's working fine but the transparent activity doesn't allow to use the call accept and reject buttons.它工作正常,但透明活动不允许使用呼叫接受和拒绝按钮。 (Touch is blocked for that System UI). (该系统 UI 的触摸被阻止)。 How to overcome this.如何克服这一点。

CustomDialog.xml CustomDialog.xml

<LinearLayout 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:orientation="vertical"
    android:layout_width="250dp"
    android:layout_height="280dp"
    android:background="@drawable/popup_shape"
    android:padding="5dp"
    android:layout_gravity="center">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/popup_title"
            android:textAllCaps="true"
            android:textColor="@color/white"
            android:textAlignment="center"
            android:layout_marginTop="20dp"
            android:textSize="16dp"
            android:textStyle="bold"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/mithra"
            android:layout_gravity="center"
            android:layout_marginTop="20dp"/>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/popup_description"
            android:textColor="@color/white"
            android:paddingHorizontal="20dp"
            android:textAlignment="center"
            android:textSize="14dp"
            android:layout_marginTop="20dp"/>
        <Button
            android:id="@+id/skipBtn"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="10dp"
            android:background="@drawable/skip_button_shape"
            android:text="Skip"
            android:textColor="@color/white"
            android:textSize="16dp" />
    </LinearLayout>
</LinearLayout>

I solved this by adding the following flag to the transparent activity我通过将以下标志添加到透明活动中解决了这个问题

getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM