問題描述
我正在開發(fā)我的第一個 Android 應(yīng)用程序,并且正在嘗試為我的活動設(shè)置樣式.最終,我希望我的活動看起來像一個對話.我在 AndroidManifest.xml
中使用以下代碼為我的所有活動提供了 Theme.Dialog
樣式:
.GalDude33 幫助我弄清楚如何實現(xiàn)我想要的.他的答案就是這個問題的答案.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.
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?
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.
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.
解決方案 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.
這篇關(guān)于如何在 Android 中將我的活動顯示為對話框?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!