English 中文(简体)
如何在roid形成共同看法
原标题:how to create a shared view in android

I am having one app where i created a view. And i want to use the same view in another application. Is there any way to pass the second apps context as parameter to the view. So that the view is created second application s context.

或者,建立观点图书馆是没有任何办法的,这样许多申请就利用图书馆来产生看法。

Ron

最佳回答

页: 1 海关编号/编码> , 包括<条码> , 并视具体情况而定。 然后,你可以在两处使用。

然而,由于你已经提出了看法,我的建议是将守则复制到你的新手里,除非你计划在今后的报告中使用同样的观点。

问题回答

I see two ways to interpret your question. 1) You have a custom View (like a custom control) and want to share it. The earlier answers address that interpretation of the question -- how to share the code that implements the View.

另一种解释是,你想要申请“A”来提供“B”所定义的屏幕。 你们不仅希望提出看法,而且希望这种观点背后的行为。

为此,我建议分享活动或分歧,而不是意见。 如果申请B愿意的话,可以通过派遣适当的实体提出申请。

我建议你采用陶基方法,或只将同样的布局复制到每个申请的Xml布局档案中。 我坚决认为,这是困难的。 这实际上比较容易。

在安的来文方中,你通常可以创建一种焦炭,并将它出口到多种仪器,以分享共同的功能。 从来没有独立尝试过。 你可以检查Gingerbread的电话。 一些功能在电话和联系器之间共享。 虽然这些观点没有分享, 理想的做法是,你可以把这一想法推向前进,执行《意见》。





相关问题
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 ...

热门标签