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

  • Home
  • SEARCH
  • 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 8187027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:25:27+00:00 2026-06-07T02:25:27+00:00

Here is my problem. I have a LinearLayout that has clickable=true for an onTouch

  • 0

Here is my problem. I have a LinearLayout that has clickable=true for
an onTouch Event so that when the LinearLayout is touched, it slides
up the screen. This works, but afterward when the onTouch Event is
fired from the new location nothing happens.

Steps:

  1. I touch the LinearLayout and it moves up like it should.
  2. I touch it again and nothing happens
  3. I touch the part of the screen where the LinearLayout was originally the LinearLayout will toggle like it should.

It appears as if the view has moved to a new location but in reality it has not.

Below is my xml & code.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/julyContainer"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">


        <RelativeLayout android:id="@+id/rel01"/> 
        <ImageView />
        </RelativeLayout>

        <ImageView             
            android:id="@+id/shadow"
            android:paddingTop="6dip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/header_barshadow"/>

<ScrollView 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/bg_calendar" 
    android:id="@+id/calScroller">


<RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">        

        <LinearLayout android:id="@+id/circleLayout"
                android:orientation="horizontal"
                android:clickable="true"
                android:onClick="@string/circleAction"              
                android:paddingTop="10dip"
                android:paddingLeft="10dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Button 
                android:id="@+id/circleCal"
                android:background="@drawable/cal_circle_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:onClick="@string/circleAction"/>

                <LinearLayout 
                android:id="@+id/circleLayout01"
                android:orientation="vertical"        
            android:paddingLeft="10dip"
            android:paddingRight="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView/>  
                <TextView/>  
                <TextView/>  

               <LinearLayout android:id="@+id/julylayout2"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:orientation="vertical">

              <TextView/>

               </LinearLayout>

            </LinearLayout>
        </LinearLayout>

       <ImageView android:id="@+id/etch1"
                  android:src="@drawable/etch_calendar"
                  android:paddingTop="15dip"
                  android:paddingBottom="15dip"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@id/circleLayout"/>                     

      <LinearLayout android:id="@+id/squareLayout"
                android:clickable="true"
                android:onClick="@string/squareAction"              
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingLeft="10dip"
                android:layout_below="@id/etch1">
        <Button 
                android:id="@+id/squareCal"
                android:background="@drawable/cal_square_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:onClick="@string/squareAction"/>

                <LinearLayout
            android:orientation="vertical"
            android:paddingLeft="10dip"
            android:paddingRight="3dip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

                <TextView/>  
                <TextView/>  
                <TextView/> 

               <LinearLayout android:id="@+id/layout3"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:orientation="vertical">

                    <TextView/>  

               </LinearLayout>
        </LinearLayout>        
    </LinearLayout>        

</RelativeLayout>
</ScrollView>      
</LinearLayout>  

CODE:

private void slideUp(View view) {
    Animation slide = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -0.25f);
    slide.setDuration(1000);
    slide.setFillAfter(true);
    slide.setFillEnabled(true);

    view.startAnimation(slide);
}

private void slideDown(View view) {
    Animation slide = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, -0.25f, Animation.RELATIVE_TO_SELF, 0.0f);
    slide.setDuration(1000);
    slide.setFillAfter(true);
    slide.setFillEnabled(true);
    view.startAnimation(slide);
}

NEW CHANGES: output of new positions

07-05 13:20:22.084: I/System.out(15187): onAnimationStart 0 , 120

07-05 13:20:23.053: I/System.out(15187): onAnimationEnd 0 , 120

private void slideUp(final View view) {

        Animation slide = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
                0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -0.75f);
        slide.setDuration(1000);
        slide.setFillAfter(true);
        slide.setFillEnabled(true);
        view.startAnimation(slide);
        slide.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                int[] startPosition = new int[2];
                view.getLocationOnScreen(startPosition);
                System.out.println("onAnimationStart " + startPosition[0] + " , " + startPosition[1]);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                final int left = view.getLeft();
                final int top = view.getTop();
                final int right = view.getRight();
                final int bottom = view.getBottom();

                int offset = (int) 0.75;
                view.layout(left, top + offset * top, right, bottom + offset * bottom);

                int[] endPosition = new int[2];
                view.getLocationOnScreen(endPosition);
                System.out.println("onAnimationEnd " + endPosition[0] + " , " + endPosition[1]);

            }

        });


    }
  • 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-07T02:25:29+00:00Added an answer on June 7, 2026 at 2:25 am

    This is normal behaviour for android animation. It is happening because animation does not really moves the layout so it’s position on the display remains the same. If you want to relocate your layout to the place where your animation ends, you need to call yourLayout.layout() method and pass there 4 parameters, which describe layout’s new position. Keep in mind that layout() gets params relative to it’s parent.

    See sample code below

    private AnimationListener slideDownAnimationListener = new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }
    
            @Override
            public void onAnimationRepeat(Animation animation) {
            }
    
            @Override
            public void onAnimationEnd(Animation animation) {
                final int left = view.getLeft();
                final int top = view.getTop();
                final int right = view.getRight();
                final int bottom = view.getBottom();
                view.layout(left, top - 0.25 * top, right, bottom - 0.25 * bottom);
            }
    };
    
    private Animation slideDownAnimation = new TranslateAnimation(
                                         Animation.RELATIVE_TO_SELF, 0.0f,
                                         Animation.RELATIVE_TO_SELF, 0.0f,
                                         Animation.RELATIVE_TO_SELF, -0.25f,
                                         Animation.RELATIVE_TO_SELF, 0.0f
                                         );
    
    private void slideDown(final View view) {
        slide.setDuration(1000);
        slide.setFillAfter(true);
        slide.setFillEnabled(true);
        slide.setAnimationListener(slideDownAnimationListener);
        view.startAnimation(slideDownAnimation);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the problem: I have two columns in a table that, for each
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
I have a vertically oriented LinearLayout that has a child LinearLayout that includes a
I have problem adding arraylist to list view, will explain about my problem here..
First, sorry for my bad english, I'm French. Here the problem : I have
Here's the problem: I have a data-bound list of items, basically a way for
Here is my problem : I have a list of messages which I can
Here is my problem: I have an array of model class(Let's say, 'addressModel' with
Here's my problem: I have do create a menu/list of actions (which would be
Here's the problem: I have couple of pages which gets its content from a

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.