Android TV: shadow size and color VerticalGridFragment

I am working on an Android TV application, but I'm not quite happy with the standard shadow rendering VerticalGridFragment, I would like it to be smaller and a bit less dark.

I looked through the code but did not find a complete working solution. In my subclass, the VerticalGridPresenteronly way I can override is createShadowOverlayOptions, but I cannot get the result that I want.

The only workaround I came up with is to define the following dimensions, so that the support advertised in the library is redefined:

<dimen name="lb_material_shadow_details_z">3dp</dimen>
<dimen name="lb_material_shadow_focused_z">4dp</dimen>
<dimen name="lb_material_shadow_normal_z">3dp</dimen>

But this is more of a hack, not the right decision.

This is the standard shadow:

Standard shadow

This is the result that I get with my current hack:

enter image description here

As you can see, it is smaller, but I can’t change the color.

VerticalGridFragment RowsFragment?

Leanback:

compile 'com.android.support:leanback-v17:25.2.0'

My minSdkVersion - 17 - Android-, , 21.

+4
1

Leanback , , - . .

. , ( ImageCardView). .

ListRowPresenter, :

ListRowPresenter . setShadowEnabled (boolean), . false isUsingDefaultShadow() .

, , ListRowPresenter, ShadowHelper ShadowHelperApi21, , . , .

ShadowOverlayHelper.Options createShadowOverlayOptions() ListRowPresenter, z.

+1

Source: https://habr.com/ru/post/1671587/


All Articles