作为对话框的活动隐藏第一个活动
问题描述:
我正在使用活动作为对话框。我希望对话框出现在其他活动上,但不会隐藏它。作为对话框的活动隐藏第一个活动
这是我的情况,对话活动总是隐藏我的主要活动。
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="tfg.marcos.coachtrain.views.DashBoardActivity">
<EditText
android:id="@+id/etDesdeFecha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:maxLength="40"
android:textSize="25sp" />
<EditText
android:id="@+id/etHastaFecha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Hasta Fecha"
android:inputType="date"
android:maxLength="40"
android:textSize="25sp" />
<EditText
android:id="@+id/etRepetirCada"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Repetir cada"
android:inputType="number"
android:maxLength="40"
android:textSize="25sp" />
</LinearLayout>
我编程方式添加主题具有因,如果我加入到这个manifest.xml中我的应用程序崩溃:
setTheme(android.R.style.Theme_Holo_Light_Dialog);
这说明我在对话活动屏幕中心和黑色。
谢谢!
答
您不能同时在屏幕上显示2个活动,这就是为什么我们有片段。你应该使用一个DialogFragment,从那里你可以得到任何你需要的Activity/context。
答
最后,我用一个fragmentdialog做到了这一点,并将其包含在我自己的布局中。谢谢
'我正在使用活动作为对话框 - 任何为什么'Dialog'或'DialogFragment'不能使用的原因? –
因为我想添加活动功能并且对话框不允许给我。对话框功能不够我想 – garciam202
试试这个android:theme =“@ android:style/Theme.Holo.Light.Dialog.NoActionBar”> – Mundroid