Android 表格布局选项卡中的键盘导航
我正在尝试实现自定义Android 表格布局选项卡中的键盘导航,android,android-tablayout,Android,Android Tablayout,我正在尝试实现自定义TabLayout,其中TabLayout中的选项卡应具有自定义背景。我想使用左/右箭头键将焦点放在选项卡项上 tabView = LayoutInflater.from(mContext).inflate(R.layout.tab_item_background,null); TextView textView = (TextView) tabView.findViewById(R.id.tab_text); textView.setText
TabLayout
,其中TabLayout
中的选项卡应具有自定义背景。我想使用左/右箭头键将焦点放在选项卡项上
tabView = LayoutInflater.from(mContext).inflate(R.layout.tab_item_background,null);
TextView textView = (TextView) tabView.findViewById(R.id.tab_text);
textView.setText(tab.getText());
tabView.setFocusable View(true);
tabView.setFocusableInTouchMode(true);
tab.setCustomView(tabView);
tab_focused.xml
当我尝试使用左/右箭头键导航时,无法获得聚焦状态。我错过什么了吗
表格布局
中有焦点的选项卡
tabItem
内部TabLayout
<size android:height="38dp" android:width="40dp"/>
<stroke android:width="2dp"
android:color="@color/lightest_blue5"/>