Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { StickerRelativeLayout = (RelativeLayout) findViewById(R.id.shsticker_relativeLayout1); RelativeLayout.LayoutParams layoutParams; layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); final ImageView view = new ImageView(getApplicationContext()); view.setPadding(10, 10, 10, 10); view.setImageResource(shstickerBaseAdaptor.shstickerImage[arg2]); view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { windowwidth = getWindowManager().getDefaultDisplay().getWidth(); windowheight = getWindowManager().getDefaultDisplay().getHeight(); android.widget.RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams(); switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: Toast.makeText(ImageEditingClass.this, "hii rma jee", Toast.LENGTH_SHORT).show(); break; case MotionEvent.ACTION_MOVE: RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) view.getLayoutParams(); int x_cord = (int) event.getRawX(); int y_cord = (int) event.getRawY(); if (x_cord &gt; windowwidth) { x_cord = windowwidth; } if (y_cord &gt; windowheight) { y_cord = windowheight; } layoutParams.leftMargin = x_cord - 15; layoutParams.topMargin = y_cord -100; layoutParams.rightMargin = x_cord - 50; layoutParams.bottomMargin = x_cord - 50; view.setLayoutParams(layoutParams); break; default: break; } return true; } }); StickerRelativeLayout.addView(view, layoutParams); Toast.makeText(ImageEditingClass.this, "you click" + arg2, Toast.LENGTH_SHORT).show(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload