Increase height of TextView on runtime
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?
精彩评论