VerticalGridFragment 显示不正确 Android Leanback

VerticalGridFragment is not displayed properly Android Leanback

我想使用 VerticalGridFragment 显示每行中的卡片。我遵循了这个 tutorial 并扩展了 VerticalGridFragment class。问题是卡片没有完全显示在视图中。这是视图的屏幕截图:

如您在上图中所见,片段仅占据视图的一小部分。这是 onCreate 方法的一个片段,我将 VerticalGridPresenter 设置为网格预设器:

public class VideoFragment extends VerticalGridFragment {
    private static final String TAG = VideoFragment.class.getSimpleName();

    public static final String CAT = "Category";
    private ArrayObjectAdapter mRowsAdapter;
    private PicassoBackgroundManager mBackgroundManager;
    private List<Movie> mItems;
    private VideosActivity mActivity;
    private Category mCategory;
    private Section mSection;

    private static final int COLUMNS = 4;
    private static final int ZOOM_FACTOR = FocusHighlight.ZOOM_FACTOR_MEDIUM;

    @Override
    public void onCreate(Bundle savedInstance) {
        Log.i(TAG, "onActivityCreated");
        super.onCreate(savedInstance);

        VerticalGridPresenter presenter = new VerticalGridPresenter();
        presenter.setNumberOfColumns(COLUMNS);
        setGridPresenter(presenter);



        setupEventListeners();
        setUpUIElements();

        getMovieItems();


        mActivity = (VideosActivity)getActivity();
        mBackgroundManager = new PicassoBackgroundManager(getActivity());
        mBackgroundManager.updateBackgroundWithDelay();
    }
}

activity 的布局文件是:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    >

    <fragment
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools" android:id="@+id/video_browse_fragment"
        android:name="app.com.tsehaytv.ui.VideoFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:deviceIds="tv"
        tools:ignore="MergeRootFrame" />

</RelativeLayout>

我尝试按照此 扩展 VerticalGridPresenter。但是,问题仍然存在。

我在这里做错了什么?我该如何解决这个问题?

问题是我使用 ListRow 来放置卡片并将 ListRow 添加到垂直网格。删除 ListRow 后,我按预期工作。