how to set width which is equal to another widget on android

前端 未结 7 422
走了就别回头了
走了就别回头了 2021-02-03 19:27

I need to draw a horizontal line below a text field such that the width of the line equals the text width (not the width of the full screen).

In my app I have a textview

7条回答
  •  盖世英雄少女心
    2021-02-03 20:05

    If you don't want to use RelativeLayout then you can set parent's width to wrap content and parent's width will become equal to biggest child. Then you can set the width of the small child to match_parent and it'll match the width of required view.

      
    
            
    
    
            
        
    

提交回复
热议问题