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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:07:45+00:00 2026-06-16T04:07:45+00:00

I have a FrameLayout with multiple ImageViews as shown in the image. I have

  • 0

I have a FrameLayout with multiple ImageViews as shown in the image.enter image description here

I have registered listeners to all these Imageviews.
I have positioned the ImageViews using android:layout_gravity, android:paddingLeft and android:paddingRight due to which the images are overlapping.

My Activity class is as follows:

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

    ivbglogin = (ImageView) findViewById(R.id.bglogin);
    ivlogin = (ImageView) findViewById(R.id.login);
    tvlogin = (TextView) findViewById(R.id.tvlogin);

    ivbgsignup = (ImageView) findViewById(R.id.bgsignup);
    ivsignup = (ImageView) findViewById(R.id.signup);
    tvsignup = (TextView) findViewById(R.id.tvsignup);

    ivbglogin.setOnClickListener(this);
    ivlogin.setOnClickListener(this);
    tvlogin.setOnClickListener(this);
    ivbgsignup.setOnClickListener(this);
    ivsignup.setOnClickListener(this);
    tvsignup.setOnClickListener(this);
}

and

@Override
public void onClick(View v) {

    switch (v.getId()) {
    case R.id.bglogin:
        Toast.makeText(AstralPadActivity.this, "bglogin", Toast.LENGTH_SHORT).show();
        break;
    case R.id.login:
        Toast.makeText(AstralPadActivity.this, "login", Toast.LENGTH_SHORT).show();
        break;
    case R.id.tvlogin:
        Toast.makeText(AstralPadActivity.this, "tvlogin", Toast.LENGTH_SHORT).show();
        openLoginDialog();

        break;

    case R.id.bgsignup:
        Toast.makeText(AstralPadActivity.this, "bgsignup", Toast.LENGTH_SHORT).show();
        break;
    case R.id.signup:
        Toast.makeText(AstralPadActivity.this, "signup", Toast.LENGTH_SHORT).show();
        break;
    case R.id.tvsignup:
        Toast.makeText(AstralPadActivity.this, "tvsignup", Toast.LENGTH_SHORT).show();
        break;

    }
}

The Framwlayout is

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="40"
    android:background="@drawable/start_bottombg" >

    <ImageView
        android:id="@+id/bglogin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingRight="194dp"
        android:paddingBottom="8dp"
        android:paddingTop="8dp"
        android:src="@drawable/start_loginbg" />

    <ImageView
        android:id="@+id/login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingBottom="15dp"
        android:paddingRight="200dp"
        android:paddingTop="15dp"
        android:src="@drawable/icon_login" />

    <TextView
        android:id="@+id/tvlogin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingRight="120dp"
        android:text="Log In"
        android:textSize="15dp"
        android:textStyle="bold" />

    <ImageView
        android:id="@+id/bgor"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_gravity="center"
        android:src="@drawable/start_or" />

    <ImageView
        android:id="@+id/bgsignup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="190dp"
        android:paddingBottom="8dp"
        android:paddingTop="8dp"
        android:src="@drawable/start_signupbg" />

    <ImageView
        android:id="@+id/signup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingBottom="15dp"
        android:paddingLeft="100dp"
        android:paddingTop="15dp"
        android:src="@drawable/icon_signup" />

    <TextView
        android:id="@+id/tvsignup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="200dp"
        android:text="Sign Up"
        android:textSize="15dp"
        android:textStyle="bold" />
</FrameLayout>

So when I click on the brown ImageView, it is calling the green one.
I want to know how to register listeners to each one of these elements and invoke those specific listeners on click of respective widgets please.

Thanks in advance.

  • 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-16T04:07:47+00:00Added an answer on June 16, 2026 at 4:07 am

    The issue was because I was using android:paddingLeft="200dp" instead of android:layout_marginLeft="100dp". Because of the padding the images were overlapping. Now it works fine.

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

Sidebar

Related Questions

I have this element in my layout XML: <FrameLayout android:id=@+id/FrameLayout01 android:layout_width=320sp android:layout_height=380sp android:layout_gravity=center android:background=#99CC33>
I have this FrameLayout: <FrameLayout android:layout_width=wrap_content android:layout_height=wrap_content android:id=@+id/searchresult_picture_layout android:background=@drawable/img_bkgd_results_patch> <ProgressBar android:layout_width=20dp android:layout_height=20dp android:layout_gravity=center android:id=@+id/searchresult_progressbar
In my foo_layout.xml file I have a subclassed RelativeLayout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android
This is maddening. I have the following XML layout: <FrameLayout android:layout_width=fill_parent android:layout_height=wrap_content android:background=@drawable/shadow android:focusable=true
I have the following layout in XML (splashscreen.xml): <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/frmLayout
I have app widget with TextView in it. <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent >
I have such layout: frame_layout.xml <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/items android:layout_width=match_parent android:layout_height=match_parent> </FrameLayout>
I have a FrameLayout (all the screen is the FL) wich haves a openGLview
I have a TextView in a FrameLayout as follows: <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" ... >
I have frame layout: <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:layout_margin=10dp > <LinearLayout android:id=@+id/widgetView android:layout_width=match_parent android:layout_height=match_parent

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.