将一个Icon放在Leanback的动作按钮中

问题描述 投票:0回答:1

我需要在此示例中添加操作按钮图标。我怎样才能做到这一点?我喜欢这个:

        String edadLabel = null;
        SparseArrayObjectAdapter sparseArrayObjectAdapter = new SparseArrayObjectAdapter(); 
        sparseArrayObjectAdapter.set(0, new Action(ACTION_1, "Action 1"));
        sparseArrayObjectAdapter.set(1, new Action(ACTION_2, "Action 2"));

我想要这个:这是屏幕截图:enter image description here

android android-studio leanback
1个回答
0
投票

尝试

sparseArrayObjectAdapter.set(0, new Action(ACTION_1, "text1", "text2", getActivity().getDrawable(R.drawable.ic_play_action_pressed)));
© www.soinside.com 2019 - 2024. All rights reserved.