2016-12-11 27 views
1

は、ここに私が作成したクラスですセットのAndroid TVでVerticalGridFragment上のカスタムタイトル

setTitleView(new MainTitleView(getActivity())); 

これは機能しません。私はデバッガでコンストラクタが呼び出されているのを見ることができますが、ヘッダーには何も付いていません。私はこの使用方法の例を見つけることができませんでしたTitleViewAdapter.Provider

助けてください。ありがとう。

+0

どのような種類のエラーが発生しましたか? – KENdi

+0

いいえ、空のヘッダのみ... – oleynikd

答えて

0
@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
    ViewGroup root = (ViewGroup) inflater.inflate(android.support.v17.leanback.R.layout.lb_vertical_grid, 
      container, false); 
    ViewGroup gridFrame = (ViewGroup) root.findViewById(android.support.v17.leanback.R.id.grid_frame); 
    installTitleView(inflater, gridFrame, savedInstanceState); 
    getProgressBarManager().setRootView(root); 
    return root; 
} 

@Override 
public View onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { 
    View title = inflater.inflate(R.layout.custom_title, parent, false); 
    //initialize your custom title view here 
    return title; 
} 

私のために働いています。 R.layout.custom_title ID:@+id/browse_title_groupの単一ビュー(com.your.company.MainTitleView)のxmlのみ。

関連する問題