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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:26:22+00:00 2026-05-24T02:26:22+00:00

Now I want to change the top margin(10 px down in every touch event)

  • 0

Now I want to change the top margin(10 px down in every touch event) of img1 in every touch event.Below is my code.I have put this code in the touch event of my activity.

  public static int  count=0;

        int place=-300;
                System.out.println("Count is:"+count);
                if(count>0)
                {
                    LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
                    lp.setMargins(0, place, 0, 0);
                        ImageView imageView=(ImageView)findViewById(R.id.img1);
                    //  MarginLayoutParams marginLayoutParams=new MarginLayoutParams(imageView.getLayoutParams());
                        //marginLayoutParams.setMargins(0, 500, 0, 0);
                        imageView.setLayoutParams(lp);
                        place=place+10;

                }
    count++; 

Now the margin is changed only in one touch event not in every touch event.

So I want that every touch of user the image should come down by 10 px

  • 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-05-24T02:26:24+00:00Added an answer on May 24, 2026 at 2:26 am

    if for every touch event above code executes… local “place” variable will be initialized to -300 each time , hence place = place + 10 will always result -290 px , please declare place variable in class level , like your count variable. Hope, this will work for you.

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

Sidebar

Related Questions

I here is my code for horizontal menu. Now i want to change this
I have an working application. Now I want to change the table names of
I have this code: <ScrollViewer x:Name=textScroller Grid.Row=2> <Grid x:Name=ContentPanel Margin=12,0,12,0 DataContext={Binding}> <Image x:Name=ImageUrl Source={Binding
I've created a gallery, and now I want to change it in the code.
I am an old time Visual SourceSafe developer but now I want to change
It's now 925*1139,I want to change it to 90*110.
I have till now mainly concentrated on web programming thus far and now want
I'm receiving an xml response and I now want to parse this. Currently what
I have a program that is been implemented in C++ which I now want
I have a ComboBox, and i want to change its look when the ItemsSource

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.