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 8641125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:26:48+00:00 2026-06-12T11:26:48+00:00

I am comparatively new to Android. Description – I have a LinearLayout with TextView

  • 0

I am comparatively new to Android.

Description –

I have a LinearLayout with TextView‘s in it.
I am adding the TextView dynamically.

When I touch the TextView, I want it to ScaleUp and when I touch the same TextView again I want it to ScaleDown.

My problems are –

  1. When a TextView is scaled up and any other TextView is touched. The older TextView should scale down and the new touched TextView should scale up.
  2. When I touch a scaled up TextView then this TextView should scale down.

This is what I have tried

I have 2 set xmls. 1 for scale up

<set xmlns:android="http://schemas.android.com/apk/res/android">
 <scale
    android:fromXScale="1.0"
    android:fromYScale="1.0"
    android:toXScale="3.0"
    android:toYScale="3.0" >
</scale>

and the other for scale down

<set xmlns:android="http://schemas.android.com/apk/res/android">
 <scale
    android:fromXScale="3.0"
    android:fromYScale="3.0"
    android:toXScale="1.0"
    android:toYScale="1.0" >
</scale>

My Activity class –

myTextView.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {

                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    if (myTextView.getAnimation() == null) {
                        Animation a = AnimationUtils.loadAnimation(
                                getBaseContext(), R.anim.scale_up);
                        a.setFillAfter(true);
                        v.startAnimation(a);
                    } else {
                        v.setOnTouchListener(new OnTouchListener() {
                            @Override
                            public boolean onTouch(View v1,
                                    MotionEvent event) {
                                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                                    Animation a1 = AnimationUtils
                                            .loadAnimation(
                                                    getBaseContext(),
                                                    R.anim.scale_down);
                                    a1.setFillAfter(true);
                                    v1.startAnimation(a1);

                                }
                                return true;
                            }
                        });
                    }
                }
                return false;
            }

        });
  • 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-12T11:26:49+00:00Added an answer on June 12, 2026 at 11:26 am

    make an collection of textviews and store states in them.. on every touch you loop this collection and search for the right textview and do appropriate things with it. You can also search trough this collection and check which textviews are scaled up or down since you are managing the states yourself.

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

Sidebar

Related Questions

I have a queue onto which pending fourier transform requests (comparatively time consuming operations)
I have been working on a comparatively large system on my own, and it's
I am fairly new to Core Text but have been getting on well, however
I have a slippy map over which I want to display a overlay with
I have a comparatively long file of unsigned integers (64 bits each, 0.47GB file)
I have sometimes seen that some applications that are built in php are comparatively
I am comparatively new to the whole jQuery thing - hence this doubt. Let
I have a generic method (see code below) and want to perform some action
So I was doing this comparative study between the application security model between android
I just started a new project, and now with ASP.NET MVC being designed in

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.