所以我一直在尋找大約一個半小時,但我無法弄清楚。我不想設置自定義主題。我想爲AlertDialog設置一個內置於android的主題。如何在Android的AlertDialog中設置主題
根據d.android.com我可以這樣做:
public AlertDialog.Builder (Context context)
或本
public AlertDialog.Builder (Context context, int theme)
所以我做到這一點,它完美的作品:
AlertDialog action_btn = new AlertDialog.Builder(MyActivity.this).create();
但是,當我需要添加一個主題時,我從eclipse得到一個錯誤:
AlertDialog action_btn = new AlertDialog.Builder(MyActivity.this, AlertDialog.THEME_TRADITIONAL).create();
如果有人能夠幫助我設置一個主題,那麼我對編程仍然很陌生。
我也有獎金的問題:
我不能得到公正AlertDialog()
工作,使其工作,我需要鍵入AlertDialog.Builder()
,但開發商的網站上,他們似乎都具有相同的方法和構造。有什麼區別/爲什麼AlertDialog()
只是工作?
唉可用。我無法相信。我看到它說「自API級別以來!」所以我認爲一切都是有效的,但是如果你向下滾動大約1/3的頁面,它就會說它只在「API Level 11」中有效。謝謝。這種簡單的解決方案。 – EGHDK 2012-02-26 01:09:48