How can I set the TextView properties like width, height using Java Code?
+1
A:
Here you have all TextView
methods:
http://developer.android.com/reference/android/widget/TextView.html
If you read the complete page, then you will become a TextView
guru.
Cristian
2010-10-23 14:20:36
Thank u so much.. it helped me a lot...
Annjo
2010-10-23 15:13:19
txtname.seWidth(100);
Annjo
2010-10-23 15:13:51
txtname is TextView name and 100 pixel is width.
Annjo
2010-10-23 15:14:24
+1
A:
In the activity where you inflate the view, you can grab the TextView
with
TextView t = (TextView)findViewById(R.id.myTextView);
where myTextView
is the id
that you declared in your XML.
Now go ahead and t.setText("Something");
, t.setWidth(200)
, ...
espinchi
2010-10-23 14:30:05