我们将向客户提供设备,他们需要能够通过按钮呼叫我们。在我的全屏Activity
中,我有一个按钮可以拨打帮助台电话号码,因此onClick()
它执行以下操作:
try {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setData(Uri.parse("tel:" + phoneNumber));
mContext.startActivity(intent);
} catch (Exception e) {
Toast.makeText(mContext, mContext.getString(R.string.couldntcall), Toast.LENGTH_LONG).show();
}
当拨号器关闭时,标题栏突然保持可见,我猜它与覆盖HOME
按钮有关:
@Override
public void onAttachedToWindow()
{ //HOMEBUTTON
if(OnLockMode())
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
else
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION);
super.onAttachedToWindow();
}
}
有人有这个问题的解决方案吗?
我尝试了以下方法:
我在清单中输入:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
并用于OnCreate
:
requestWindowFeature(Window.FEATURE_NO_TITLE);
在这两个onCreate()
以及在onResume()
:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
仍然显示标题栏。