开发者

Increase height of TextView on runtime

开发者 https://www.devze.com 2023-01-13 03:13 出处:网络
I have a TextView and I want to increase its height on runtime. I have used android:layout_height=\"wrap_content\" but it did not gave me the desired result.开发者_JAVA百科

I have a TextView and I want to increase its height on runtime.

I have used android:layout_height="wrap_content" but it did not gave me the desired result.开发者_JAVA百科

I'm using a Relative Layout.

i get text through edittext and i want to set it on textview. when i do this it shows only one line, and when i click on edittext it get expanded and full message is shown.


Add in Oncreate method of your Activity class,

((TextView) findViewById(R.id.YOURTEXTVIEWIDHERE)).setHeight(IntegerValuePixels);


hard to tell without more details - but do you really need to change it on runtime? because obviously you're not happy with the height at startup.

have you thought about using android:layout_height="fill_parent", eventually in combination with the android:minHeight attribute of other components?

0

精彩评论

暂无评论...
验证码 换一张
取 消