我有一个文本视图,我试图在运行时更改其大小。但尺寸不变。
xml文件中的代码
<TextView
android:id="@+id/textScreenWidth"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text=""
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="12dp"
OnCreat 上的代码更改大小
TextView t=(TextView) findViewById(R.id.textScreenWidth);
t.setWidth(950);
尺寸没有改变
用这个:
t.getLayoutParams().width = 950;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)