java - Unable to display the long images without making them look "Stretched" -


please check below layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/activity_view_message"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     tools:context="xxx.xxx.xxx.xxx.activities.viewmessageactivity">      <scrollview         android:layout_width="match_parent"         android:layout_height="match_parent">          <linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_marginbottom="10dp"             android:layout_marginleft="10dp"             android:layout_marginright="10dp"             android:layout_margintop="24dp"             android:background="@drawable/linear_border"             android:orientation="vertical">              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_marginleft="5dp"                 android:layout_marginright="5dp"                 android:layout_margintop="12dp"                 android:orientation="horizontal">                  <de.hdodenhof.circleimageview.circleimageview xmlns:app="http://schemas.android.com/apk/res-auto"                     android:id="@+id/view_message_channel_img"                     android:layout_width="64dp"                     android:layout_height="64dp"                     android:layout_marginleft="5dp"                     android:src="@drawable/sm_human"                     app:civ_border_color="#ff000000"                     app:civ_border_width="0.5dp" />                  <linearlayout                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:layout_marginleft="10dp"                     android:layout_marginright="10dp"                     android:orientation="vertical">                      <linearlayout                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_margintop="5dp"                         android:orientation="horizontal">                          <textview                             android:id="@+id/view_message_channel_name_txt"                             android:layout_width="match_parent"                             android:layout_height="wrap_content"                             android:layout_weight="1"                             android:text="john doe"                             android:textcolor="@android:color/black"                             android:textsize="12sp" />                          <textview                             android:id="@+id/view_message_duration_txt"                             android:layout_width="match_parent"                             android:layout_height="wrap_content"                             android:layout_weight="2"                             android:text="3h ago"                             android:textalignment="textend"                             android:textsize="12sp" />                      </linearlayout>                      <textview                         android:id="@+id/view_message_time_txt"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_margintop="18dp"                         android:text="jan 6 @ 4.55 pm"                         android:textsize="12sp" />                  </linearlayout>              </linearlayout>              <textview                 android:id="@+id/view_message_message_txt"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_marginleft="15dp"                 android:layout_marginright="10dp"                 android:layout_margintop="12dp"                 android:text="daily dose of proper pills"                 android:textcolor="@android:color/black"                 android:textsize="12sp" />               <imageview                 android:id="@+id/view_message_image"                 android:layout_width="match_parent"                 android:layout_height="256dp"                 android:layout_margintop="12dp"                 android:background="@android:color/darker_gray"                 />              <!--<videoview-->                 <!--android:id="@+id/view_message_video_view"-->                 <!--android:layout_width="match_parent"-->                 <!--android:layout_height="256dp"-->                 <!--android:layout_margintop="12dp" />-->              <fm.jiecao.jcvideoplayer_lib.jcvideoplayerstandard                 android:layout_width="match_parent"                 android:layout_height="250sp"                 android:id="@+id/video_player"/>              <textview                 android:layout_width="match_parent"                 android:layout_height="48dp" />          </linearlayout>      </scrollview>  </linearlayout> 

i trying make images visible in view_message_image. case whenever "long portrait" image available stretched below.

enter image description here

i tried using wrap_content height, both height , width of imageview made image totally dissaper, nothing got visible.

how can fix issue?

try line in imageview ;

android:scaletype="fitxy" 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -