我正在使用 xamarin android 制作一个 android 应用程序,在该应用程序中我使用 cardview 和回收器视图。
问题
图像高度超过文本的换行内容。
想要什么
我希望图像大小是文本覆盖的大小。
我试过的:
我尝试将图像设置为线性布局的背景,但它设置的布局本身的高度比下图中显示的要大得多。我已经尝试在 framelayout 中设置它,但它给出了与下面相同的结果
有关图像的详细信息
数字随卡片视图的实例一起提供
1:图像图像源高度正在增加视图高度
2:此图设置完美,因为原图高解析度低,图片被拉伸查看
3:再次图像高度分辨率高,因此视图被图像扩展
4,5 cardview 没有图像
我的代码:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cardView"
app:cardBackgroundColor="@android:color/transparent">
<ImageView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:id="@+id/cardImage"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/templateLayout"
>
<TextView
android:text="Title:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:id="@+id/listTitle"/>
<TextView
android:text="Start Time:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="@+id/listSTime"/>
<TextView
android:text="End Time:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="@+id/listFTime"/>
<TextView
android:text="Description:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="@+id/listDescription"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
图片:

