Marco Schmitz wrote:
>> //android:layout_width="150px"
>> tv.setWidth(150);

That will not reliably work AFAIK. See below.

>> //android:layout_height="wrap_content"
>> ???

All of the layout_ attributes are messages to the widget's *container*,
not to the widget itself.

To adjust those layout_ attributes at runtime, you need to:

1. Instantiate an appropriate ViewGroup.LayoutParams subclass (e.g.,
LinearLayout.LayoutParams).

2. Configure the LayoutParams from step #1.

3. Call setLayoutParams() on the widget.

>> //android:textColor="#ffffff"
>> tv.setTextColor(Color.rgb(0xff, 0xff,0xff));    // tv.setTextColor
>> (0xffffff) doesn't work somehow

Colors in Android in Java are in AARRGGBB format, where the AA refers to
the alpha channel. So 0xFFFF0000 is solid red, and 0x80FF0000 is a 50-50
mix of red and whatever the background color is.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to