Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 表格布局选项卡中的键盘导航_Android_Android Tablayout - Fatal编程技术网

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"/>