Java 无法显示长图像而不使其看起来“拉伸”
请检查下面的布局Java 无法显示长图像而不使其看起来“拉伸”,java,android,android-layout,android-imageview,android-image,Java,Android,Android Layout,Android Imageview,Android Image,请检查下面的布局 <?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/act
<?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 at 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>
我试图使图像在视图中可见。这种情况下,只要长肖像图像可用,它就会像下面那样被拉伸
我尝试使用wrap_内容来表示高度,包括imageview的高度和宽度,但这使图像完全不可见,没有任何可见内容
如何解决此问题?在ImageView中尝试这一行
否决投票人:在继续之前,在此处张贴否决投票的原因。这就是s.O的工作原理。我做到了,但没有改变
android:scaleType="fitXY"