简体   繁体   中英

Change LinearLayout height by number of lines of textview in java

I have a textview in a LinearLayout, and I want the height of LinearLayout to be changed from the number of lines in textview, please sombody will help me and tell me how can I do it without any problems?

I'm not sure if I understand your question correctly. There is no illustration or examples

but I believe you can make the LinearLayout's height to be wrap and the child's TextView to have lines="3" for example

by that your linearlayout will have a height of 3 lines as per the above example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM