Skip to content

Handler appearing outside of the list #8

@ak83

Description

@ak83

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);

}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions