Setting width of TextView in java

How to set TextView properties as width and height using Java code?

+6
java android textview
source share
2 answers

In an action where you inflate a view, you can capture a TextView with

 TextView t = (TextView)findViewById(R.id.myTextView); 

where myTextView is the id you specified in your XML.

Now go ahead and t.setText("Something"); , t.setWidth(200) , ...

+7
source share

Here you have all the TextView methods:

http://developer.android.com/reference/android/widget/TextView.html

If you read the full page, you will become a TextView guru.

+2
source share

All Articles