This HorizontalScrollView layout or its LinearLayout parent is useless

后端 未结 1 1192
迷失自我
迷失自我 2021-01-28 20:14

I am new in android programming I have problem with horizontalscrollview. I have error \"This HorizontalScrollView layout or its LinearLayout parent is useless\" on



        
1条回答
  •  佛祖请我去吃肉
    2021-01-28 20:22

    First of all, this is not an error but a warning - the code will still work correctly.

    Now, as you can see, you have:

    
        
    
        
    
    

    There is only one child in the LinearLayout - and it's another ViewGroup - therefore you can get rid of the outer LinearLayout and simply keep the HorizontalScrollView:

    
    
    
        ...
    
    

    However if you are adding any Views to the LinearLayout in your code (i.e. as siblings to your HorizontalScrollView) then the correct thing is to ignore this warning.

    0 讨论(0)
提交回复
热议问题