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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:27:37+00:00 2026-05-23T23:27:37+00:00

This is more work I’m doing on creating a ListView with customisable overscroll. I

  • 0

This is more work I’m doing on creating a ListView with customisable overscroll.

I want to create a Custom element which extends RelativeLayout but adding child view’s isn’t working at all well. The code seems right but the view looks slightly insane.

    underscrollEdge = new ImageView(context);
    underscrollEdge.setImageResource(R.drawable.underscroll_edge);
    underscrollGlow = new ImageView(context);
    underscrollGlow.setImageResource(R.drawable.underscroll_glow);
    overscrollGlow = new ImageView(context);
    overscrollGlow.setImageResource(R.drawable.overscroll_glow);
    overscrollEdge = new ImageView(context);
    overscrollEdge.setImageResource(R.drawable.overscroll_edge);

    RelativeLayout.LayoutParams topLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    topLayout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    addView(underscrollEdge, topLayout);
    addView(underscrollGlow, topLayout);        

    RelativeLayout.LayoutParams bottomLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    bottomLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    addView(overscrollGlow, bottomLayout);      
    addView(overscrollEdge, bottomLayout);  

This, strangely, gives this (I’ve set the relative layout to black to show the edges and glows):

As you can see, the top edge is floating in the middle of nowhere and the bottom glow has shrunk to a teeny tiny size…. What the heck?

  • 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-23T23:27:37+00:00Added an answer on May 23, 2026 at 11:27 pm

    Love how writing down the problem helps me solve it:

        RelativeLayout.LayoutParams topLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        topLayout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        addView(underscrollGlow, topLayout);        
        topLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        topLayout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        addView(underscrollEdge, topLayout);    
    
        RelativeLayout.LayoutParams bottomLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        bottomLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        addView(overscrollGlow, bottomLayout);      
        bottomLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        bottomLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        addView(overscrollEdge, bottomLayout);  
    

    Using the same LayoutParams for two components make’s things go weird. Seems onerous but it does fix things.

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

Sidebar

Related Questions

This code used to work but doesnt any more. i used a breakpoint, and
We have been discussing this at work and now I am even more confused
I want to know this more in detail. Is it a realtime scheduler? An
I know I could have an attribute but that's more work than I want
I'd like to know which of the ways to do this syntax is more
I've started doing more and more work with the new Mathematica statistics and data
There is about 2000 lines of this, so manually would probably take more work
I'm posting this more because I'd like to learn more, because my work-around has
I want to make my CMS work like this, if you would write certain
To make this more clear, I'm going to put code samples: $file = fopen('filename.ext',

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.