SupperMary
V2EX  ›  Android

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

  •  
  •   SupperMary · Oct 23, 2019 · 13669 views
    This topic created in 2395 days ago, the information mentioned may be changed or developed.

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

    TableLayout
        Button
        TableRow
            Button
            Button
        TableRow
        Button
    TableLayout
    

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

    1 replies    2019-10-25 21:11:45 +08:00
    skyinsea
        1
    skyinsea  
       Oct 25, 2019
    试试对第一个 button 添加 android:nextFocusDown/Forward 属性,值为第二行的第一个 button。
    如果不行的话再把第二行的 TableRow 加个 focusable="false"试试。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5464 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 08:48 · PVG 16:48 · LAX 01:48 · JFK 04:48
    ♥ Do have faith in what you're doing.