English 中文(简体)
如何在对话框和活动之上创建幻灯片幻灯片?
原标题:How to create a slide in slide out pop up on top of dialogs and activities?

我想执行一个弹出, 该弹出应滑入活动顶部和任何对话框顶部。 另外, 当弹出在屏幕上时, 背景中的活动和对话框仍应是交互式的( 即它们应对触碰作出反应, 所有按钮等仍应有效 ) 。 x 时间后, 弹出应滑出屏幕 。

我提出以下想法,但所有想法都存在某种缺陷:

1.Custom Toast While the toast would always appear on top of activities and dialogs, I dont think it can be made to slide in and slide out.

2. Custom dialog The dialog would also come on top of activity and dialogs but the problem here is that the while my custom dialog is on screen, the activity and all the previously opened dialogs would not be interactive anymore (i.e. they will not take touches).

3. ImageView in Activity The problem with this approach is obvious: it would always appear behind dialogs.

任何帮助都会感激不尽 谢谢!

问题回答

以下是您的选项 :

1) 与敬酒者一起出进出,牺牲你的动画

2) 与对话并牺牲触碰事件

3) 这不可行

我什至无法想到你如何用定制观点做这件事,

也许为了启发另一种解决你问题的办法,请在这里尝试:http:// developer.android.com/deign/index.html

真正要问的问题是,为什么你想要这个工具提示?你想要实现什么?用这些答案,你可以找到一个更“机器人”的解决方案。

您真的需要一个子类视图, 而不是对话框。 使用添加 View () 来添加您的视图, 删除 View () 来删除它 。

通过布局/型式, 您可以让它看起来像一个对话框 。

您可以通过查看动画来实现幻灯片的进出效果。

Animation slideIn = new TranslateAnimation (windowWidth, 0, 0, 0);
slideIn.setDuration (400);
slideIn.setInterpolator(new LinearInterpolator());
dialogView.startAnimation(slideIn);

Animation slideOut = new TranslateAnimation (0, windowWidth, 0, 0);
slideOut.setDuration (400);
slideOut.setInterpolator(new LinearInterpolator());
dialogView.startAnimation(slideOut);

并使用动画听器在动画 End () 上进行动画听器,以在滑出后删除视图 。

您需要调整翻译动画的 x/y 参数, 以实现您想要的效果, 假设您想要的对话框以 x 和 y 轴为中心...





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签