如何更改标题的颜色和标题项目的颜色

如何更改标题的颜色和标题项目的颜色

本文介绍了Android TV,如何更改标题的颜色和标题项目的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改标题颜色(Hello Android TV!)和行颜色的标题项目(GridItemPresenter).

I want to change title color(Hello Android TV!) and headeritem for row color(GridItemPresenter).

推荐答案

要更改列表行标题样式,您必须使用自定义 ListRowPresenter :

To change the list row header style you must use custom ListRowPresenter:

public class CustomListRowPresenter extends ListRowPresenter {
    public CustomListRowPresenter() {
        super();
        setHeaderPresenter(new CustomRowHeaderPresenter());
    }
}

public class CustomRowHeaderPresenter extends RowHeaderPresenter {
    @Override
    public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
        Presenter.ViewHolder viewHolder = super.onCreateViewHolder(parent);
        RowHeaderView rowHeaderView = (RowHeaderView) viewHolder.view;
        rowHeaderView.setTypeface(...);
        rowHeaderView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, ...);
        return viewHolder;
    }
}

对BrowseFragment没有任何直接的经验,但是我希望也有某种自定义演示者.

Haven't had any direct experience with BrowseFragment, but I expect there is some kind of a custom presenter too.

这篇关于Android TV,如何更改标题的颜色和标题项目的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:38