views:

35

answers:

0

Hi everyone,

I need to implement drag & drop for my View. That works nicely but i need to set starting position for my View based on layout parameters.

Here's the code:

        RelativeLayout lay=(RelativeLayout)findViewById(R.id.low_and_high_layout);
        android.widget.RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.CENTER_HORIZONTAL);          

        NoteView2 note=new NoteView2(this);       
        note.setLayoutParams(params);
        lay.addView(note,params); 

My overrided onDraw() function draws based on 'x' and 'y' position of the View element. How can i get that starting 'x' and 'y' position of my View element which is based on the layout parameters?

Thx in advance