views:

113

answers:

1
<ImageView android:id="@+id/ImageView01" 
    android:layout_gravity="center_horizontal"
   android:layout_marginTop="30dip"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:scaleType="fitCenter"
    android:adjustViewBounds="true">

hi friends, i want to set this property in coding for image view not use this,how can i make it ?

Thanks all

A: 

in you java code there is some methods like for the textview you can do this :

TextView test = (TextView)find...;

test.setText("blah blah");

or

test.setId("blah");

or

test.setTextColor()

ect

so for a ImageView it's much the same : take your ImageView and if you have eclipse + adt (i hope) it's almost automatic

ImageView picture = (ImageView) findViewById(R.id.ImageView01);
picture.setLayoutParams(picture.LayoutParams.WRAP_CONTENT, picture.LayoutParams.WRAP_CONTENT);

and ect. =D

Tsunaze