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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:05:38+00:00 2026-05-23T08:05:38+00:00

The property android:layout_gravity=clip_vertical|horizontal does the following as mentioned in the SDK documentation: Additional option

  • 0

The property android:layout_gravity="clip_vertical|horizontal" does the following as mentioned in the SDK documentation:

Additional option that can be set to
have the top and/or bottom edges of
the child clipped to its container’s
bounds. The clip will be based on the
vertical gravity: a top gravity will
clip the bottom edge, a bottom gravity
will clip the top edge, and neither
will clip both edges.

But I can’t see anything of this in my applications,

so what is the purpose of this property exactly ?

thanks

  • 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-23T08:05:38+00:00Added an answer on May 23, 2026 at 8:05 am

    Short version:

    clip_horizontal and clip_vertical apply to the measurements of the view itself, before any contents (such as the image in a BitmapDrawable) are rendered.


    Long version:

    I’ve run into some similar confusion over clip_horizontal and clip_vertical. (In my case, it was related to android:gravity for a BitmapDrawable, but it’s similar enough to be applicable.)

    From the documentation I thought that something like android:gravity=”top|left|clip_vertical” on a bitmap would cause the image’s top left corner to be positioned at the view’s top left corner, and that, if the bitmap was taller than the view, it would be “clipped” at the bottom edge of the view. In other words, show only as much of the bitmap that the view is tall enough to reveal; do not stretch the bitmap, but instead only show whatever will fit, letting the rest extend below the bottom edge.

    However, the opposite happened: when I set clip_vertical, a large bitmap was squished vertically to fit within the height of the view.

    After examining the applyDisplay() method in platform/frameworks/core/java/android/view/Gravity.java, I realized my mistake:

    It isn’t the bitmap image that was going to be clipped, but the view — the actual size of the container the image is ultimately rendered into.

    Setting clip_vertical in my case didn’t mean “clip the image at the bottom edge,” it meant “clip the BitmapDrawable’s view itself so its height matches the height of its parent container”…which then caused the image to be “squished” as it filled that shorter height.

    So, the important thing to remember with android:gravity and android:layout_gravity is that clip_horizontal and clip_vertical apply to the measurements of the view itself, before any contents (such as my BitmapDrawable) are rendered.

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

Sidebar

Related Questions

I am trying to set textColor property of button in android 2.1. But I
any property can set the pin in google map bigger? from what i know,
If I have a property: public list<String> names { get; set; } How can
I would like to know if is there a way to call android:layout_gravity property
I hope I can explain this properly. I'm making an android app that, when
I set a background image to a layout via the android:background property. I want
How can I set the property of an TextView which comes under a RelativeLayout
I have a TextView in my android application that has a set width on
I have a class property exposing an internal IList<> through System.Collections.ObjectModel.ReadOnlyCollection<> How can I
I have a public property set in my form of type ListE<T> where: public

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.