I just started learning to program android now that I've gotten my
Droid Incredible. I've done some reading and playing around, but seem
to be having a hard time getting my layouts to work like I want with
different sized displays.

I was trying to plan ahead and make sure that my application would
work on different sized screens. I was wanting to have a TextView of
the application name that would dynamically change based on the width
of the screen it was on. I added this to my activity constructor after
calling setContentView(R.layout.main).

DisplayMetrics metric = new DisplayMetrics();
TextView title = (TextView) findViewById(R.id.TitleTextView);
title.setTextSize(TypedValue.COMPLEX_UNIT_PX, metric.widthPixels);

However, this doesn't seem to change the size of the text. I even
tried different metric values, but short of hard coding my size, I
can't seem to figure this out nor find any documents that point me in
the right direction. I would appreciate any insight as to what I am
doing wrong or a link to more information about fitting the text in a
TextView to the width of the display.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to