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

The Archive Base Latest Questions

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

I have a 9 patch png in a RelativeLayout and everything looks great! However,

  • 0

I have a 9 patch png in a RelativeLayout and everything looks great! However, when i create a textView in the RL, the textView is not at the top of the parent… I also tested this on the phone, same result… why does it do this?

Thanks for your assistance!

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/testLL"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/backrepeat"
    >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_margin="15dp"
        android:layout_gravity="center_vertical|center_horizontal"
        android:background="@drawable/contentbox">

        <TextView
            android:text="Test"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"/>

    </RelativeLayout>
</LinearLayout>

RelativeView
TextView

  • 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-22T11:57:25+00:00Added an answer on May 22, 2026 at 11:57 am

    In looking up how 9patches are rendered, it basically turns the non-stretchable areas into default layout padding. This is to facilitate easy entry of stuff into the target (stretchable) area, without having to go in and define paddings manually. By assigning a 9patch, you are using it’s padding. It assigns paddings to top left right and bottom based on how many px the 9patch has until it reaches the stretchable center.

    You may try doing something like android:paddingTop=”-50px” in your textView and see what happens. I haven’t tested this, so I’d be interested to see how it turns out.

    Edit to your comment with pic: Since your 9patch’s top stretchy region doesnt start for about 90 px, its automatically going to pad the first element 90 px down, to place it within the “stretchy target” region. Try my above suggestion to see how it works, I’m pretty interested to see how it turns out. I don’t have my IDE accessible from my Mobile, otherwise I’d test it for you 😉

    Edit: I apologize, I’ve been saying “padding” instead of margin. But the theory is the same. Not modifying the above for permanent documentation of my idiocy.

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

Sidebar

Related Questions

In Draw 9-patch, everything looks fine. However , my SDK says the 9-patch png
I have a url similar to /abc/1.png i then rewrite it to /full/path/1.png. However
I have a textview and a nine-patch image. Assigning this image in the xml
I have three 9-patch PNG's which together make up the background for a button
I am trying to create a custom-styled seekbar. I have two nine-patch images one
I have created a 9-patch image (splash.9.png) for my splash screen. The issue is,
I want to stroke a path using a .png that I have but I
I have stored images from the net like this Documents/imagecache/domain1/original/path/inURI/foo.png Documents/imagecache/domain2/original/path/inURI/bar.png Documents/imagecache/... Documents/imagecache/... Now
I have this piece of code: <table style=background-image: url(path/to_image.png)> And when I load it
I am using Engine InnoDB on my MySQL server. I have a patch script

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.