Reputation: 55
I want to load an URL into an imageView located in a different layout than the current activity layout.
I don't know what's this com.rey.material package and where it comes from. I assume maybe it is used by the template i've been importing. Do you have an idea on how to fix this problem ?
theListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, final View view, final int pos, long l) {
// Unfold cell first then Change Stuff inside
// toggle clicked cell state
((FoldingCell) view).toggle(false);
// register in adapter that state for selected cell is toggled
adapter.registerToggle(pos);
final LayoutInflater factory = getLayoutInflater();
final View cell = factory.inflate(R.layout.cell, null);
ImageView image = (ImageView) cell.findViewById(R.id.head_image);
Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(image);
}
});
This is the layout that wraps everything together :
<com.ramotion.foldingcell.FoldingCell xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:folding-cell="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
folding-cell:additionalFlipsCount="2"
folding-cell:animationDuration="1300"
folding-cell:backSideColor="@color/bgBackSideColor"
folding-cell:cameraHeight="30">
<!-- CONTENT (UNFOLDED) LAYOUT (MUST BE AT LEAST 2x times BIGGER than content layout bellow)-->
<include layout="@layout/cell_content_layout" />
<!-- TITLE (FOLDED) LAYOUT (MUST BE AT LEAST 2x times SMALLER than content layout above) -->
<include layout="@layout/cell_title_layout" />
</com.ramotion.foldingcell.FoldingCell>
And this is the layout containing the specific imageView :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/head_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/head_image" />
</RelativeLayout>
</LinearLayout>
Upvotes: 0
Views: 2925
Reputation: 1
replace:
android.support.v7.widget.AppCompatImageView
with:
androidx.appcompat.widget.AppCompatImageView
Upvotes: 0
Reputation: 145
I know i am late to the party, but just in case some is banging his head for same problem, here is one possible solution that worked for me when i was trying to add zoom functionality in my pager adapter images
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/head_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/head_image" />
</RelativeLayout>
In the above code, just Replace <ImageView
with <com.yourPackage.TouchImageView
.
TouchImageView (or any other class) is a custom class (you need to make)which should extend android.support.v7.widget.AppCompatImageView
Upvotes: 0
Reputation: 55
Never mind, it was a misclick on my part:
When importing packages for ImageView
, I clicked the first package instead of the usual one, which caused this problem. Solution:
Replace
import com.rey.material.widget.ImageView
with
import android.widget.ImageView
Upvotes: 1