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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:30:26+00:00 2026-05-31T19:30:26+00:00

I am trying to stack image views beside each other (with 70% overlapping). I

  • 0

I am trying to stack image views beside each other (with 70% overlapping). I used a frameLayout and gave each elemnet padding of 10. It worked but this padding is killing me when it comes to handling events. Is there any better way of overlapping views (use different layout..etc)? I am developing for Android 2.3

   <RelativeLayout android:layout_height="fill_parent"  
android:layout_width="fill_parent" >

    <FrameLayout     
    android:id="@+id/frameLayoutBottom"      
    android:layout_width="wrap_content"      
    android:layout_height="wrap_content"     
    android:layout_alignParentBottom="true"      
    android:layout_centerHorizontal="true" > 
    <ImageView          
    android:id="@+id/ivBottom1"          
    android:layout_width="wrap_content"          
    android:layout_height="wrap_content"          
    android:src="@drawable/c10" />      
    <ImageView      
    android:id="@+id/ivBottom2"          
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"                        
    android:paddingLeft="10dp"          
    android:src="@drawable/c11" /> 

By the way, when I try the margin instead of padding, the images are still on top of eachother 100%

  • 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-31T19:30:28+00:00Added an answer on May 31, 2026 at 7:30 pm

    Create a custom ViewGroup that lays out it’s children in onLayout. There are quite a few examples if you search for “custom ViewGroup onLayout”. In general, the onLayout method override looks like this:

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {}
    

    Inside that method, you will want to use getChildCount() and getChildAt(index) to get references to your child views. Once you have them, you can use the l,t,r, and b values to compare the bounds of your ViewGroup and figure out where to layout the children.

    Once you find the children and calculate where you want them, you’ll use child.layout(l,t,r,b) to place the child view inside your new custom ViewGroup.

    Hope this helps. if you REALLY need to hack this into XML, you can try the following :

    <RelativeLayout    
    android:layout_width="fill_parent"      
    android:layout_height="fill_parent"> 
    <ImageView 
    android:id="@+id/spacer1"         
    android:layout_width="10dp"          
    android:layout_height="wrap_content" />         
    <ImageView       
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"         
    android:src="@drawable/whatever1" /> 
    <ImageView       
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:layout_toRightOf="id/spacer1"        
    android:src="@drawable/whatever2" /> 
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access the raw pixels of an image, but I keep
I'm using Oracle 10g and I'm trying to stack the conditions in a CASE
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console
I am trying to implement a Stack in java (using the list interface: Interface
So I have a nasty stack overflow I have been trying to track down
I'm getting stack overflow errors when I'm trying to publish() a NetStream after close()ing
Ran into an Out of Stack Space error trying to serialize an ASP.Net AJAX
I'm trying to run some statistics over the Stack Overflow data dump, and for
All I am trying to do is XmlSerializer serializer = new XmlSerializer(typeof(Stack<int>)); and I

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.