java - Image height getting compressed on Android -


i trying create facebook-like feed on app.

for image on every post, trying scale occupy full width of post -

<relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:paddingtop="12dp">         <imageview             android:id="@+id/image"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:scaletype="fitxy"             android:adjustviewbounds="true"             android:layout_alignparentleft="true"             android:layout_alignparentstart="true"             android:layout_alignparentright="true"             android:layout_alignparentend="true"             android:layout_marginleft="3dp"             android:layout_marginstart="3dp"             android:layout_marginright="3dp"             android:layout_marginend="3dp" /> </relativelayout> 

i have used relativelayout wrapper make work on different devices properly.

however, encounter strange problem on phones (nexus s , nexus 1 per android studio emulator's test screens, , on samsung galaxy duos phone) -

the image scales occupy full width of parent not scale in height maintain aspect ratio.

i have tried changing height of imageview in java code doesn't seem work. image still appears if hammered top shorten height.

i know if there solution can use solve problem across android screens.

you using android:layout_height="wrap_content" height not change . either should define width , height static .set display width height code.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -