如何反映在Android上presentation片段? [英] How to mirror a fragment to a presentation in Android?

查看:584
本文介绍了如何反映在Android上presentation片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的标题,也许是为那些谁熟悉这一主题的笑话,但我preFER希望你们学习。

My title is maybe a joke for those who know well the subject but I prefer ask you to learn.

所以我的目标是在外部显示器显示一个特定的片段,当我连接设备。很显然,我发现从commonsware漂亮谟cwac- presentation: https://github.com / commonsguy / cwac- presentation

So my goal is to display ONE specific fragment in an external display when I connect the device. Obviously I found the nice projet cwac-presentation from commonsware : https://github.com/commonsguy/cwac-presentation

我设法运行的 SimpleMirrorActivity WebMirrorActivity 它们分别显示的镜子的的EditText 的和在相同的布局的网页。

I managed to run the demo of SimpleMirrorActivity and WebMirrorActivity which display respectively a mirror of an EditText and a webpage on the same layout.

然后,我看着怎么类 镜像presentationActivity 工程及管理运行它。它显示在外接显示器的网页。

Then, I looked at how the class MirrorPresentationActivity works and managed to run it. It displays a webpage in the external display.

但我的目标是要显示一个特定的片段,我不认为有这样一个例子。我读了大量的时间的描述 镜像presentationFragment 但是没仍然知道如何运行它。

But my goal is to display one specific fragment and I don't think there is an example of that. I read lots of time the description of MirrorPresentationFragment but didn't still understand how to run it.

是否有可能得到一个例子或更多的解释做呢?

Is it possible to get one example or more explanations to do it?

谢谢,这将帮助我很多东西。

Thanks, that will help me a lot.

推荐答案

步骤1:将您的一个特定的片段为 MirroringFragment 的子类。引用文档

Step #1: Convert your "one specific fragment" to be a subclass of MirroringFragment. Quoting the documentation:

MirroringFragment的工作原理非常像一个普通的片段。然而,而不是覆盖onCreateView(),重写onCreateMirroredContent()。 onCreateMirroredContent()采用相同的参数一样onCreateView(),和你的工作是一样的:创造的片段中显示的内容。所不同的是,你的返回视图将被包裹在一个MirroringFrameLayout。

MirroringFragment works much like a regular Fragment. However, instead of overriding onCreateView(), you override onCreateMirroredContent(). onCreateMirroredContent() takes the same parameters as does onCreateView(), and your job is the same: create the content to be displayed by the fragment. The difference is that your returned View will be wrapped in a MirroringFrameLayout.

使用 MirroringWebViewFragment 为这应该是什么样子的例子。或者,只是使用 MirroringWebViewFragment 直接,如果你的一个特定片段恰好是一个 WebViewFragment

Use MirroringWebViewFragment as an example of what this should look like. Or, just use MirroringWebViewFragment directly, if your "one specific fragment" happens to be a WebViewFragment.

第二步:创建并使用镜子presentationFragment 。引用文档

Step #2: Create and use a MirrorPresentationFragment. Quoting the documentation:

镜象presentationFragment是presentationFragment旨在镜像MirroringFragment的内容。要使用此功能,使用newInstance()工厂方法,以一个语境和所需的显示器作为参数创建一个实例。然后,调用setMirror()在你的MirroringFragment,提供镜presentationFragment。从那里,你可以显示()和罢免()镜presentationFragment,就像任何其他的presentationFragment。由具有MirroringFragment在主屏幕上,并具有外接显示器,无论用户操作在屏幕上呈现给外部显示器,非常适合presentation设置(例如,会议)上镜presentationFragment。

MirrorPresentationFragment is a PresentationFragment designed to mirror the contents of a MirroringFragment. To use this, create an instance using the newInstance() factory method, taking a Context and the desired Display as parameters. Then, call setMirror() on your MirroringFragment, supplying the MirrorPresentationFragment. From there, you can show() and dismiss() the MirrorPresentationFragment as you would any other PresentationFragment. By having the MirroringFragment on the main screen, and having the MirrorPresentationFragment on an external display, whatever the user manipulates on the screen is rendered to the external display, ideal for presentation settings (e.g., conferences).

有关如何使用指令 presentationFragment 一般(其中镜子presentationFragment 是一个子类),请参见文档
<一href=\"https://github.com/commonsguy/cwac-$p$psentation/blob/master/demo/src/com/commonsware/cwac/$p$pso/demo/Mirror$p$psentationActivity.java\"相对=nofollow> 镜像presentationActivity 演示如何使用镜子presentationFragment

For instructions on how to use a PresentationFragment in general (of which MirrorPresentationFragment is a subclass), see the documentation. MirrorPresentationActivity demonstrates using a MirrorPresentationFragment.

第三步:啤酒

这篇关于如何反映在Android上presentation片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆