2014-09-02 61 views
0

是否可以使用Android註釋API設置自定義標題?以前我會打電話自定義標題與Android註釋

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 

getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_layout); 
在onCreate方法

,但這並沒有出現在註釋的方法@AfterViews成爲可能,因爲它被設定內容查看之前完成。有沒有辦法做到這一點?

+0

看看這個http://androidcodesnippetsblog.blogspot.in/2013/03/custom-window-title-bar-in-android.html – 2014-09-02 04:49:37

+0

博客中描述的方法是指我用來添加標題的方式到活動。我在問題中提到的代碼(在博客中提到)必須放在onCreate方法中,requestWindowFeature必須在contentView設置之前進行。使用AndroidAnnotations時,它看起來像我不能使用onCreate方法。 – 2014-09-02 05:22:18

+0

夥計們,你應該看看AA [wiki](https://github.com/excilys/androidannotations/wiki)。 – WonderCsabo 2014-09-02 15:39:34

回答

1

我在使用com.googlecode.androidannotations,androidannotations-api版本2.7.1。有一個更新的版本; org.androidannotations,androidannotations版本3.0.1,其中包含@CustomTitle註釋完美的作品。