任何应用程序屏幕上创建对自定义对话框 [英] Creating cutom dialog box on any apps screen
问题描述
我只是想让它出现在任何应用程序屏幕对话框。我可以在应用程序创建2,3,4如应用1 this.Means对话框对话框...屏幕。
I just want to let it appear that dialog box over any apps screen. I can create dialog box like this.Means Dialog box of application 1 over application 2,3,4... screens.
请帮助创建对话框活动的形象?在这里, http://i.stack.imgur.com/6Gs8G.png
Please Help to create dialog box activity as in the image?? Here http://i.stack.imgur.com/6Gs8G.png
让我解释一下,在镀铬首先我必须点击要下载的文件,然后使用意图Android的下载管理器使用其编辑器的活性捕捉URI ..和创建对话框这样。
let me explain, in chrome first i have clicked the file to download, then using intents "Android download manager" used its editor activity to capture the URI.. and created dialog box like this.
但我想做到这一点,在此图像中的Android的下载管理器的对话框是在铬。所以我怎么可以创建时,其意图所调用的任何应用程序/屏幕上会出现这样的对话框。当我尝试做对话框而不的setContentView我的程序崩溃。
but i want to do that, in this image the dialog box of android download manager is over chrome. so how can I create such dialog box that appears on any app/screen when its invoked by intent. when i try to do dialog box without "setContentview" my program crashes.
推荐答案
您可以使用此布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Link:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/browser" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/settings" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/unnamed" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/EditText01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
和java中code作为一般定义的TextView和ImageView的和...等。
and in java code as usually define textview and imageview and ... etc.
Button image1 = (Button) dialog.findViewById(R.id.imageView1);
.
.
.
dialog.show();
这篇关于任何应用程序屏幕上创建对自定义对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!