android - ImageView doesn't adhere to layout rules when image is set -
i'm setting image on relative layout scaled. when image set, layout alignment rules broken. image supposed align left hand side, shifts. larger image further left hand edge image placed. other layout items text rely on placement of image move. scaled image looks fine apart placement.
the image 200px, actual size of bar's height 70dp. resize image id know why happens.
edit - have tried setting image dynamically image.setimageresource(r.drawable.placeholder);
   <?xml version="1.0" encoding="utf-8"?> <relativelayout         xmlns:android="http://schemas.android.com/apk/res/android"         android:orientation="vertical"         android:background="@drawable/footer"         android:layout_width="match_parent"         android:layout_height="match_parent"         >     <imageview             android:id="@id/icon"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:src="@drawable/placeholder"             android:layout_alignparentleft="true"             />     <textview             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:text="test"             android:layout_marginleft="15dp"             android:layout_torightof="@id/icon"             android:layout_above="@id/username"/>      <textview             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:id="@id/username"             android:text="user name test"             android:layout_marginbottom="15dp"             android:layout_marginleft="15dp"             android:layout_torightof="@id/icon"             android:layout_alignparentbottom="true"/>     <togglebutton             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:background="@drawable/play_media_btn_toggle"             android:layout_margintop="15dp"             android:id="@id/play"             android:layout_alignparentright="true"             android:texton=""             android:textoff=""/> </relativelayout> 
setting adjustviewbounds of imageview true might fix problem. default, imageviews don't scale bounds when  content gets scaled, creating messed layout.
Comments
Post a Comment