V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
SupperMary
V2EX  ›  Android

安卓开发,怎么在 TableRow 里面的控件上移动焦点

  •  
  •   SupperMary · 2019-10-23 16:41:10 +08:00 · 4654 次点击
    这是一个创建于 1619 天前的主题,其中的信息可能已经有所发展或是发生改变。

    度娘谷歌无果,来求助一下。 现在有一个布局是这样的

    TableLayout
        Button
        TableRow
            Button
            Button
        TableRow
        Button
    TableLayout
    

    如上,有个 Table 布局,里面第一行是一个 button,第二行是两个并排 button,第三行也是一个 button,这个是一个 TV 上用的 APP,焦点只能通过上下左右在这几个 Button 上移动,但是目前在第二行时,焦点会选中整行,而不是其中一个 button,我想让焦点能选中其中的 button,请问一下这种情况应该怎么做。

    1 条回复    2019-10-25 21:11:45 +08:00
    skyinsea
        1
    skyinsea  
       2019-10-25 21:11:45 +08:00
    试试对第一个 button 添加 android:nextFocusDown/Forward 属性,值为第二行的第一个 button。
    如果不行的话再把第二行的 TableRow 加个 focusable="false"试试。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3265 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:47 · PVG 18:47 · LAX 03:47 · JFK 06:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.