Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:30:20+00:00 2026-06-07T10:30:20+00:00

As part of a much more complex piece of functionality I’ve become stuck on

  • 0

As part of a much more complex piece of functionality I’ve become stuck on the ability to show a circle becoming opaque at a certain point of the screen.

I’ve gone as far as to create a test project where my Animation code is as follows:

View mLongPressImage;

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

    mLongPressImage = findViewById(R.id.onPressImage);

     findViewById(R.id.button).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startAnimation(v.getX(), v.getY());
            }
        });
}

private AlphaAnimation onPressAnimation;

private void startAnimation(final float f, final float g) {
    Log.v("", "START");
    mLongPressImage.setX(f);
    mLongPressImage.setY(g);
    onPressAnimation = new AlphaAnimation(0f, 1f);
    onPressAnimation.setDuration(1000);
    onPressAnimation.setFillAfter(true);
    onPressAnimation.setFillEnabled(true);
    mLongPressImage.startAnimation(onPressAnimation);
}

Logging show’s the correct event’s are happening.

View looks like so:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="PRESS ME" />

    <ImageView
        android:id="@+id/onPressImage"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:background="#000000"
        android:scaleType="fitXY"
        android:src="@drawable/shape_circle_onpress" />

</FrameLayout>

Right now the Image simply appears at the coordinates after 1 second has passed.

Can anybody point out the hidden flaw in this extremely simple piece of functionality?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:30:22+00:00Added an answer on June 7, 2026 at 10:30 am

    The above code seems to be technically correct which is why I was having such a big problem solving it.

    The issue was caused by me using setX() and setY() and Animation together – On my Xoom tablet (running 3.2 API 13) this caused some pretty funky behaviour even after switching to ScaleAnimation.

    Removing the setX() and setY() removes the glitchy behaviour as does switching to a Galaxy Nexus (Running API 4.0 Icecream Sandwich). Setting hardwareAccelerated to true instead of removing the setX() and setY() also improved the problem (but didn’t fix it completely).

    If anyone know’s why this is I’ll be more than happy to upvote and change the accepted answer on this one. I’m going to chalk it up to a flakey Android API until then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is kinda....a two part question. The first one is much more important than
I have the code below (this is actually part of a much more complicated
this is the last part of my a bit more complex homework which I
(this is indirectly a part of a much larger homework assignment) I have something
Since you 'should' learn C/C++ and as part of 'learn as much languages as
I'm looking to do some complex part analysis within Seimens NX. I'm looking to
Basically it's a task to manage properties, and I am doing a much more
On the iPad we get much more room to work with, so presenting full
Part of the GUI I'm building using tkinter has a pop-up window that says
Part of my web application is a background script that polls from a beanstalkd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.