简体   繁体   English

Android TV:从ListRowPresenter中的项目删除阴影

[英]Android TV: Remove shadow from Item in ListRowPresenter

I am trying to remove shadow from the list item when that Horizontal list is not in focus. 当该水平列表未聚焦时,我试图从列表项中删除阴影。 I am extending my fragment from RowSupportFragment and then creating ListRowPresenter like this 我从RowSupportFragment扩展我的片段,然后像这样创建ListRowPresenter

val listRowPresenter = ListRowPresenter(FocusHighlight.ZOOM_FACTOR_XSMALL)
    listRowPresenter.shadowEnabled = false
    ArrayObjectAdapter listRowAdapter = ArrayObjectAdapter(listRowPresenter)

and adding two ArrayObjectAdapter later on when data comes from server. 并在以后数据来自服务器时添加两个ArrayObjectAdapter

    listRowAdapter?.add(ListRow(null, objectAdapter1))
    listRowAdapter?.add(ListRow(null, objectAdapter2))

The line listRowPresenter.shadowEnabled = false is suppose to remove the shadow from the list rows but it is not giving the required behavior. listRowPresenter.shadowEnabled = false是为了从列表行中删除阴影,但未提供所需的行为。 Can anyone point to some classes or any example that can be helpful? 任何人都可以指出一些有用的类或示例吗?

I found the solution for this i am posting it for future reference. 我找到了解决方案,我将其发布以供将来参考。 If you want to remove the shadow from the items of unselected row you need to add these to you ListRowPresenter . 如果要从未选中的行中删除阴影,则需要将其添加到ListRowPresenter

    listRowPresenter.shadowEnabled = false
    listRowPresenter.selectEffectEnabled = false

and it will remove the shadow from the item. 它将删除项目中的阴影。 For more customization you can override ShadowOverlayHelper class that is initialized inside ListRowPresenter . 要进行更多自定义,您可以覆盖在ListRowPresenter内部初始化的ShadowOverlayHelper类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM