To align the background image to center and not stetched : in java code ANDROID (not manifest) -
To align the background image to center and not stetched : in java code ANDROID (not manifest) -
i'm new android development.
i'm trying set background app using line of code
getwindow().setbackgrounddrawableresource(r.drawable.my_imagename); that works perfectly. problem image appears stretched. should create align in center (exactly original image) , not stretched.
i appreciate help.
you seek utilize xml layout background image:
<framelayout android:id="@+id/fm_id" android:layout_width="img_width" android:layout_height="img_height" ... ... > <imageview android:id="@+id/imageview1" android:layout_width="match_parent" android:layout_height="match_parent" android:adjustviewbounds="true" android:layout_gravity="center" android:gravity="center" android:background="@drawable/my_imagename" /> </framelayout> hope help
android
Comments
Post a Comment