简体   繁体   English

使用按钮更改TextView大小

[英]Using Button To Change TextView Size

I'm new to this but I have some understanding. 我对此并不陌生,但我有所了解。 Currently I have an app that consists of lots of TextViews with a specific size , however i want to be able to implement a Button able change the TextView size of a TextView or all TextViews. 目前,我有一个包含许多具有特定大小的TextView的应用程序,但是我希望能够实现一个Button,该按钮能够更改TextView或所有TextView的TextView大小。 Can I have some help please with this with examples of codes (I prefer java) Thank You! 我可以通过代码示例(我更喜欢Java)获得帮助吗?谢谢!

On click of button you can change layout params of the textview you want to resize as following: 单击按钮后,您可以更改要调整大小的textview的布局参数,如下所示:

TextView tv=<find>
LayoutParams lp = (LayoutParams) tv.getLayoutParams();
lp2.height = 100;
tv.setLayoutParams(lp);
tv.requestLayout();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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