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

Handler appearing outside of the list #8

Open
ak83 opened this issue Jul 7, 2014 · 0 comments
Open

Handler appearing outside of the list #8

ak83 opened this issue Jul 7, 2014 · 0 comments

Comments

@ak83
Copy link

ak83 commented Jul 7, 2014

I used the same layouts for row and main activity as they are on the main page, except I changed the list width to 200dp.

When I do this and start dragging the view, the star (drag handler) shows up on the wrong place. Instead of showing where the it is shown in the list it shows up in the middle of the screen.

Here is the layout file:

<com.terlici.dragndroplist.DragNDropListView
    android:id="@id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="match_parent" />

Here is the row layout:

<ImageView
    android:id="@+id/handler"
    android:layout_width="60px"
    android:layout_height="60px"
    android:src="@android:drawable/btn_star_big_on"
    android:layout_marginLeft="8px"
    />

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

And here is the main activity code:
package com.example.ddexample;

import java.util.ArrayList;
import java.util.Hashtable;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import com.terlici.dragndroplist.DragNDropListView;
import com.terlici.dragndroplist.DragNDropSimpleAdapter;

public class MainActivity extends Activity
{

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    DragNDropListView list = (DragNDropListView) findViewById(android.R.id.list);

    ArrayList<Hashtable<String, String>> xxx = new ArrayList<Hashtable<String, String>>();
    for (int a = 0; a < 100; a++)
    {
        Hashtable<String, String> fsa = new Hashtable<>();
        fsa.put(String.valueOf(a), String.valueOf(a));

        xxx.add(fsa);
    }
    DragNDropSimpleAdapter adapter = new DragNDropSimpleAdapter((Context) this, xxx, R.layout.row, new String[] { "1" }, new int[] { R.id.text },
            R.id.handler);

    list.setDragNDropAdapter(adapter);

}

}

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