我想插入一个图像到一个ImageView,它被用作背景。这个背景是在一个RecyclerView中。当它被第一次加载,它看起来像这样:毕加索中心适合和适合会得到不同的结果
但是当我滚动到另一项目和向后滚动,它看起来像这样(它应该永远是这样):
在这里,我添加图像:
public void onBindViewHolder(StoryViewHolder holder, int position) {
holder.cardView.setMinimumHeight(height/3);
holder.layout.setMinimumHeight((int) ((float) width/4));
//set image
Picasso.with(activity).load(MainPostAdapter.URL + 140 + ".png").
transform(new BlurTransform(holder.background.getContext())).fit().centerCrop().into(holder.background);
holder.background.setAlpha(0.25f);
}
而且这是图片本身:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/story_view_background"/>
问题是什么?
编辑: 整个XML(它不显示所有的代码这里也是引擎收录:http://pastebin.com/8rJvSx7V):
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/story_view_background"/>
<RelativeLayout
android:id="@+id/story_view_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="50px">
<ImageView
android:id="@+id/story_view_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/story_view_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_below="@+id/story_view_image"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</FrameLayout>
显示更多XML,问题。你的'ImageView'可能应该有不同的宽度和高度设置 – snachmsm
@snachmsm我已经更新了它。 – user6586661