How to set the width and height of an ImageView programmically?

by Dianne Hackborn » Mon, 27 Apr 2009 11:16:16 GMT

Sponsored Links
 The standard way you force the size of a view is with
android:layout_width="999dp" and android:layout_height="999dp".

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Other Threads

1. Determining size of SD Card?

Hi All,

Can we determine the size of the emmualted sdCard though our Java File
i know its supported in 1.6 like

file.getFreeSpace() etc....

but i can't get Android compile FileBrowser project using java 1.6 sdk.
it just don't recognize file.getTotalSpace() api.

FileBrowser project runs well for java 1.5 & 1.6, but it shows compile
errors the moment i introduce any java 1.6 specific api's.

I have updated the project settings & Windows / Preferences of Eclipse so
that it uses the java 1.6 sdk.
Even the JAVA_HOME & PATH System variables are updated to point to java 1.6
and java -version & javac -version returns 1.6.

Does Android support's java 1.6 at all or not ?
Is there any way we could find the total space available in SD Card through

Your help is much appreciated.



2. Quick notes on getting G1 and adb goign

Many thanks to zhobbs and the guys on IRC!

If you're having problems getting G1 and adb behaving on Linux, kill off 
the running adb process (sudo pkill adb, or possibly adb kill-server -- 
didn't try that one). That cleared things up -- adb devices showed the 
device, and adb install installed the app.

At this point, if you have no emulator running, adb commands (e.g., adb 
install) should route to the device. If you have an emulator running, 
use the -s switch to route the command to the appropriate device (e.g., 
adb -s deviceidhere shell). In the example, deviceidhere is the 
identifier listed via adb devices.

Mark Murphy (a Commons Guy)
_The Busy Coder's Guide to Android Development_ Version 1.3 Published!


3. Can't debug apps on G1

4. Emulator clock app are not the same time with the display on top bar

5. Req Info abt DDMS tool

6. Marketplace details now available

7. J2ME apps for Android