Note that there are some explanatory texts on larger screens.

plurals
  1. POwhen i was dragging down the image,the button is not working
    primarykey
    data
    text
    <p>In my xml on button i want to declare image,when i was dragging down the image the button clicking was not working,it was in background,it does come the forground. </p> <p>How can it be possible to use button? I want to display toast meassage when i click on button. </p> <pre><code>public class MainActivity extends Activity { /** Called when the activity is first created. */ ImageView img = null; AbsoluteLayout aLayout; int status = 0; int Measuredwidth = 0, MeasuredHeight = 0; float x = 0; boolean first = true; Bitmap icon; Button b; @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); aLayout = (AbsoluteLayout) findViewById(R.id.absLayout); img = (ImageView) findViewById(R.id.imageView); icon = BitmapFactory.decodeResource(getResources(), R.drawable.gg); b = (Button) findViewById(R.id.btnFavorites); Point size = new Point(); WindowManager w = getWindowManager(); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB_MR2) { w.getDefaultDisplay().getSize(size); MeasuredHeight = size.y; Measuredwidth = size.x; } else { Display d = w.getDefaultDisplay(); Measuredwidth = d.getWidth(); MeasuredHeight = d.getHeight(); } b.setOnClickListener(new OnClickListener() { public void onClick(View v) { b.setVisibility(View.GONE); Toast.makeText(MainActivity.this, "activity closed", Toast.LENGTH_LONG).show(); } }); aLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if (event.getAction() == MotionEvent.ACTION_UP) { status = 0; // img.setBackgroundColor(Color.TRANSPARENT); } else if (event.getAction() == MotionEvent.ACTION_DOWN) { if (first) { x = event.getX(); first = false; } } else if (event.getAction() == MotionEvent.ACTION_MOVE) { // } if ((event.getX() &lt; (Measuredwidth - icon.getWidth() / 2) &amp;&amp; event .getX() &gt; (icon.getWidth() / 2)) &amp;&amp; (event.getY() &lt; MeasuredHeight - (icon.getHeight() + 60) &amp;&amp; event.getY() &gt; icon .getHeight() / 2)) { @SuppressWarnings("deprecation") // (int) event.getX()-img.getWidth()/2 LayoutParams lp = new AbsoluteLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, (int) 0, (int) event .getY() - img.getHeight() / 2); img.setLayoutParams(lp); } return true; } }); } } </code></pre> <p>Layout</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/btnFavorites" android:layout_width="match_parent" android:layout_height="45dip" android:drawablePadding="10dp" android:paddingLeft="10dp" android:layout_marginTop="1dip" android:gravity="left|center_vertical" android:background="#242D41" android:drawableLeft="@drawable/ic_launcher" android:includeFontPadding="false" android:textColor="#ffffff" android:textSize="15dip" android:textStyle="bold" /&gt; &lt;AbsoluteLayout android:id="@+id/absLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="1dip" &gt; &lt;ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/gg" android:scaleType="matrix" &gt; &lt;/ImageView&gt; &lt;/AbsoluteLayout&gt; &lt;/FrameLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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