Dun*_*una 1 android selected television menuitem leanback
我想为TV元素的BrowseFragment更改选定元素的缩放值。可能吗?还是在browserfragment中硬编码的zoom os?
这是更改卡的缩放倍数的方法。在MainFragment / RowsFragment中,您必须使用ListRowPresenter。您可以通过这种方式进行初始化。
ListRowPresenter presenter= new ListRowPresenter(FocusHighlight.ZOOM_FACTOR_LARGE,true);
Run Code Online (Sandbox Code Playgroud)
在这里,您可以更改FocusHighlight Factor,您可以找到许多其他值,或者可以根据需要选择任何值。这些是这些值。
ZOOM_FACTOR_MEDIUM, ZOOM_FACTOR_SMALL, ZOOM_FACTOR_XSMALL, ZOOM_FACTOR_NONE
如果在第二个参数中传递false,则可以消除所有网格上的暗光效果。您可以随便玩玩,这里还有一些其他可能的功能可以使用
presenter.setShadowEnabled(false);
presenter.enableChildRoundedCorners(false);
presenter.setSelectEffectEnabled(false);
presenter.setKeepChildForeground(false);
Run Code Online (Sandbox Code Playgroud)
这些在库中默认为true。
如果您想自定义leanback的RowsFragment或BrowseFragment的设计,则只需获取它的XML文件,然后就可以进行设计。您可以放置自己的实现。这只是您还可以自定义leanback其他片段的一个想法。
这是RowsFragment的布局,我已经更改了一些颜色,因此您可以理解,请使用“ lb_rows_fragment.xml ” 将其保存在res目录下的布局中,不要忘了像我所说的那样命名。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/descriptions_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/main_screen_prog_desc_height"
>
<RelativeLayout
android:id="@+id/description_parent_view"
android:layout_width="@dimen/main_screen_prog_desc_width"
android:layout_height="wrap_content"
>
<!--you can add description etc here or any other stuff. whatever you like. -->
</RelativeLayout>
<android.support.v17.leanback.widget.ScaleFrameLayout
android:id="@+id/scale_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/descriptions_layout"
android:background="#fff"
android:layout_marginRight="170dp">
<android.support.v17.leanback.widget.VerticalGridView
android:id="@+id/container_list"
style="?attr/rowsVerticalGridStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#45f"
android:clipToPadding="false"/>
</android.support.v17.leanback.widget.ScaleFrameLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1365 次 |
| 最近记录: |