我有與此圖像項目的列表視圖:機器人列表視圖與圖像項目來調整圖像高度proportionaly
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/llItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@color/white"
android:layoutDirection="rtl"
android:orientation="horizontal">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="@color/white"
app:cardElevation="4dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/pollimg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</android.support.v7.widget.CardView>
我需要在getview方法的圖像視圖加載到陣列適配器如下:
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
....
etc
.....
try {
Picasso.with(context)
.load(allpolls.get(position).getMediaUrl()).fit()
.placeholder(R.mipmap.icon).into(holder.img);
} catch (Exception e) {
holder.img.setVisibility(View.GONE);
}
}
我的問題是,所有行的imageview高度是固定的,我需要將imageview高度設置爲與在線圖像相同的圖像高度。所以它可以採取它的確切高度
發表您的完整佈局...代碼 – rafsanahmad007
問題是更新PLZ檢查 – Amalo