我想添加一些附加信息到來電屏幕。對於我的應用程序,我正在檢查PHONE_STATE和RINGING,我打電話給一個活動。在這個活動中,我正在設置一個文本視圖如下。android:覆蓋來電屏幕
其按預期工作。文本被添加到來電屏幕 我的作品是:
如果我在我的應用程序,即在我的應用程序的視圖中,並且如果傳入呼叫來,android傳入窗口來和消失。我的應用程序窗口到了頂部,應該忽略來電窗口的文本視圖也可見。
請解釋此行爲。我怎樣才能解決這個問題?
super.onCreate(savedInstanceState);
Log.i(TAG,"oncreate");
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.incomingcallscreen);
TextView name = (TextView)findViewById(R.id.textView1);
name.setText(getIntent().getExtras().getString("NAME"));
incomingCallActivityContext = this;
和佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="250dip"
android:src="@drawable/icon"
android:text="CALLER NAME"
android:textSize="35sp"
android:textColor="@color/WHITE"
android:layout_gravity="center_horizontal"
android:windowAnimationStyle="@android:style/Animation.Translucent"
android:windowBackground="@android:color/transparent"
android:windowIsTranslucent="true" />
</LinearLayout>
,我相信我有過這個問題。這可能是兩件事之一。 首先,在顯示覆蓋層之前,嘗試添加1000毫秒的延遲,以防輸入呼叫窗口進來 如果這樣不起作用,請在此處查看答案:http://stackoverflow.com/a/5512519/ 653362我想我升級到薑餅後最後使用了吐司法。 – Guykun
嗨,謝謝你的回覆。我的問題與MODIFY_PHONE狀態無關。如果我不在我的應用程序中,我的行爲正常。如果在我的應用程序中,覆蓋屏幕正在覆蓋我自己的活動屏幕,並將撥號器推到後面。你有沒有遇到這個問題?你記得howit被修正了。我已經有時間延遲。首先我的撥號器出現了,然後當我的上面的屏幕彈出時,我的當前活動也出現了 – png