Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in case of listview #3

Open
manpreetsinghsodhi opened this issue Jul 20, 2015 · 0 comments
Open

Not working in case of listview #3

manpreetsinghsodhi opened this issue Jul 20, 2015 · 0 comments

Comments

@manpreetsinghsodhi
Copy link

I have a listview with each listitem shown in xml. But when i use the library there, the effect is not coming well.

Here is my xml of each list item

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginBottom="10dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="10dp"
 >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="fill_parent"
        android:layout_height="350dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:background="#212121"

        android:scaleType="centerCrop" />

    <ImageView
        android:id="@+id/btn_go"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="20dp"
            android:focusable="false"
        android:focusableInTouchMode="false"
        android:scaleType="centerCrop"
        android:src="@drawable/heart_detail" />

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="60dp"
        android:layout_alignParentLeft="true"
        android:layout_marginTop="20dp"
        android:paddingLeft="20dp"
        android:textColor="#ffffff"
        android:textSize="27sp" />

    <TextView
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_below="@+id/text"
        android:paddingBottom="20dp"
        android:paddingLeft="20dp"
        android:textColor="#ffffff"
        android:textSize="20sp" />
</RelativeLayout>

and here is my adapter on which i m calling this library
private class ViewHolder {
ImageView imageView, img;
TextView t, t_price;
}

public View getView(final int position, View convertView, ViewGroup parent) {
 holder = null;
    RowItem rowItem = getItem(position);

    Log.v("position global", position + "");
    val = position;
    LayoutInflater mInflater = (LayoutInflater) context
            .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.item, null);
        holder = new ViewHolder();

        holder.imageView = (ImageView) convertView.findViewById(R.id.icon);
        holder.img = (ImageView) convertView.findViewById(R.id.btn_go);
        holder.t = (TextView) convertView.findViewById(R.id.textview);
        holder.t_price = (TextView) convertView.findViewById(R.id.text);

        holder.img.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                Log.v("pos is", position + "");
                System.out.println("position is" + position);

                //host = MainActivity.hostd.get(position).toString();
                new CircleAnimationUtil().attachActivity((Activity) context).setTargetView(holder.imageView).setDestView(holder.img).startAnimation();
                //new wishlist().execute();
            }
        });
        convertView.setTag(holder);
    } else
        holder = (ViewHolder) convertView.getTag();

    holder.t.setText(rowItem.getText());
    holder.t_price.setText("Rs. " + rowItem.getAmount());
    Picasso.with(context).load(rowItem.getImageId())

    .into(holder.imageView);
    return convertView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant