我的工作我的第一个Android应用程序,和我想我的风格的活动。最后,我想为我的行为看起来一样的对话。我给我的所有活动 Theme.Dialog
使用以下code在风格上我的的AndroidManifest.xml
:
I am working on my first Android application, and am trying to style my activity. Ultimately, I would like for my activity to look the same as a dialog. I have given all my activities the Theme.Dialog
style using the following code in my AndroidManifest.xml
:
<application
android:icon="@drawable/group"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog">
</application>
这给我的活动浮动的外观和对话框的边界,而不是风格的标题。那个标题就是具有相同的颜色和外观作为一般的对话框的背景,而不是头背景和边框作为一个真实的对话框。请注意这两个例子中的头有一个漂亮的下边框,并在第二个,它有一个渐变背景。
This gives my activities the "floating" appearance and the borders of a dialog, but not the styled title. The title just has the same color and appearance as the general dialog background, not the "header" background and border as in a "real" dialog. Notice how in both examples the header has a nice border under it and in the second one, it has a gradient background.
有没有一种方法,以确保我的活动标题莫名其妙地继承了系统对话框的标题,以便有效地复制我的活动对话框的外观 - 除了边境和浮动,它自带的 Theme.Dialog
的风格呢?
Is there a way to make sure the title on my activity somehow inherits the system dialog title so as to effectively replicate the look of a dialog for my activity - in addition to the border and "float" which comes with the Theme.Dialog
style?
请注意,我不想叫我的活动从另一个对话框,我只是希望它的的查找的像dilaog,即使在响应装以意图按我的清单的意图过滤器。
Note that I do not want to call my activity as a dialog from another, I just want it to LOOK like a dilaog, even when it is loaded in response to an intent as per my manifest's intent-filters.
地址:有可能还有一些方法可以让我有我的活动,当它旋转起来的onCreate()
,调用一些方法来转自己变成一个实际的对话?牢记的活性仍然需要能够从系统响应意图。
ADD: Is there perhaps some way I can have my activity, when it spins up in onCreate()
, call some method to turn itself into an actual dialog? Keep in mind the activity still needs to be able to respond to intents from the system.
决定看后的的什么的我想做的事,而不是,怎么办它的文章中,我发现了一个不同的方法。我老师又问道我的问题寻找办法的想法,而不是实现想法here. GalDude33帮我弄清楚如何实现我想要的东西。他的回答有这个问题的答案。Q
After deciding to look at what I wanted to do, instead of how to do it specifically, I found a different approach. I reasked my question looking for approach ideas instead of implementation ideas here. GalDude33 helped me figure out how to achieve what I wanted. His answer there was the answer to this Q.