【发布时间】:2016-10-17 00:23:24
【问题描述】:
我正在使用 git 示例中的 VerticalGridFragment 仅显示信息而不希望用户交互。我成功关闭了关注 CardPresenter.cs 的用户,但我还想更改所有卡片,使其不暗淡。
这是课程的屏幕截图和我想关闭的调光。 http://corochann.com/verticalgridfragment-android-tv-application-hands-on-tutorial-19-718.html
我曾尝试更改 CardPresenter 类中的 alpha,但这似乎没有任何作用。任何帮助将不胜感激!
CardPresenter.cs
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
mDefaultBackgroundColor =
ContextCompat.getColor(parent.getContext(), R.color.default_background);
mSelectedBackgroundColor =
ContextCompat.getColor(parent.getContext(), R.color.selected_background);
mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie, null);
ImageCardView cardView = new ImageCardView(parent.getContext()) {
@Override
public void setSelected(boolean selected) {
updateCardBackgroundColor(this, selected);
super.setSelected(selected);
}
};
cardView.setAlpha(1.0f);
cardView.setFocusable(false);
cardView.setFocusableInTouchMode(false);
updateCardBackgroundColor(cardView, false);
return new ViewHolder(cardView);
}
【问题讨论】:
标签: android android-fragments android-tv leanback