Android image view gravity
问题 How can I dynamically set the gravity ? Bitmap bmp; im = new ImageView (this); bmp=getbmp(img); im.setImageBitmap(bmp); Now I would like to put the image in the top . Ho can I do this without android:gravity in main.xml ? EDIT : main.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical" > </ScrollView> I have a frame layout and I add