【发布时间】:2017-08-31 07:52:17
【问题描述】:
我正在将活动用作对话框。我希望对话框出现在其他活动上,但不隐藏它。
这是我的情况,对话活动总是隐藏我的主要活动。
这是代码:
<?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);
这显示了屏幕中心的对话活动,周围是黑色的。
谢谢!
【问题讨论】:
-
I am working with activity as dialog- 为什么不能使用Dialog或DialogFragment? -
因为我想添加活动功能并且对话框不允许我使用。我认为对话框功能较少
-
试试这个 android:theme="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
-
我尝试了这个和所有的对话主题,但对我不起作用...
-
because i want to add activity functionality- 在DialogFragment中,您可以像使用Fragment一样调用getActivity()?
标签: android android-activity dialog