2012-09-06 28 views
0
我使用ActionBarSherlock和很多我的應用程序使用方法的setTitle片段

,例如:ActionBarSherlock和某種壓倒一切的方法的setTitle

getActivity().setTitle(articleName); 

但我使用自定義樣式的動作條和不斷變化的冠軍時,我想在我的TextView上改變它。

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:gravity="center" 
      android:textColor="@color/grey" 
      android:id="@+id/bar_title" 
      style="@style/Text.Medium"> 
    </TextView> 

</LinearLayout> 

是否有可能,也許覆蓋setTitle並添加我自己的代碼來做到這一點?

回答

0

由於setTitle方法不是最終的,您可以在Activity中覆蓋它,然後在Fragment之內使用它。