我一直试图在活动对话框中实现一个自定义主题,目标是
我在展示
Progressbar
在关闭“活动”和“我的活动”对话框之前15秒,如下所示
尽管它正在做它应该做的事情,但我仍然没有得到以下结果
一。
背景是“
透明的
“我希望它像第一张截图一样完全透明
2.
我把活动称为
ExcludeFromRecents = true
但它仍然显示在
最近的应用程序
在这15秒内列出
现在说到代码,
我的对话框布局如下-
DialogActivityLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="bottom|center"
android:gravity="bottom"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressRecicer"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:gravity="bottom"/>
</RelativeLayout>
我的对话主题样式如下
styles.xml
<style name="AppCompatDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
我的活动代码如下
[Activity(Label = "Dialog Activity", MainLauncher = false, Theme = "@style/AppCompatDialogTheme", ExcludeFromRecents = true)]
我的活动
OnCreate(Bundle savedInstanceState)
方法如下
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.DialogActivityLayout);
Window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent));
this.SetFinishOnTouchOutside(false);
this.SetTheme(Resource.Style.AppCompatDialogTheme);
Toast.MakeText(this, "Dialog Activity Opened", ToastLength.Long).Show();
Handler h = new Handler();
Action myAction = () =>
{
Finish();
};
h.PostDelayed(myAction, 15000);
我们非常感谢为实现这两个目标所提供的任何帮助