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

  • Home
  • SEARCH
  • 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 7761219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:04:52+00:00 2026-06-01T14:04:52+00:00

I have a fairly simple layout with an image, and some textviews wrapped in

  • 0

I have a fairly simple layout with an image, and some textviews wrapped in a vertical LinearLayout. Whenever I set the background of this layout to be a 9patch, the height of the layout seemingly gets set to the height of the 9patch (even though the 9patch seems to successfully stretch to be the height of the layout.)

If I use a solid background color, the height of the layout works as intended.

Here’s a screenshot with the 9patch in place:

enter image description here

Here’s a screenshot with a solid background instead of the 9patch (notice how the text is centered in the layout now):

enter image description here

And finally, here’s the XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/show_gray"
    android:gravity="center_vertical"
    android:orientation="horizontal" android:weightSum="5">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="4"
        android:scaleType="centerCrop"
        android:src="@drawable/temp_featured_banner" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#FF0000"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingLeft="30dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Large Text"
            android:textColor="@color/white" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Small Text"
            android:textColor="@color/white" />
    </LinearLayout>

</LinearLayout>

… and just in case, here’s a screenshot of draw9patch showing my 9patch drawable:

enter image description here

I suspected that the LinearLayout wasn’t taller than the natural size of the 9patch (so there was nothing to stretch..), so I reduced the 9patch in height by 50%. The problem still existed.

Any ideas?

  • 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-01T14:04:53+00:00Added an answer on June 1, 2026 at 2:04 pm

    The top and left of the nine patch refer to the ‘stretchable’ area of the image. The right and bottom of the nine-patch define where the content should go – currently, you’re just telling it to guess (and it guesses by putting all of the content in the line designated by the top left dot). from what I can tell from your image, you probably want a solid black line top to bottom (leaving out the corners, of course) on the right of the nine-patch, and a matching dot to your top-right black dot on the bottom. This tells the OS where to put the content in relation to the image so that it better knows how to stretch the image.

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

Sidebar

Related Questions

I have fairly simple layout, like this: <div class=card> <span class=attack>1</div> <span class=defence>2</div> </div>
I have a fairly simple const struct in some C code that simply holds
I have a fairly simple set of functionality for which I have multiple implementations,
I have a fairly simple bash script that does some grep to find all
I have this fairly simple form: <form action=...> <div> <input type=text class=input-text value= name=text
I have a fairly simple layout required. <ul> <li>Link</li> </li>Link</li> </ul <ul> <li>Link</link> <li>Link</link>
I have a fairly simple ASP.NET application, set up as a Web Application Project
I have a fairly simple xml file that has an image button in it.
I have a fairly simple class that looks like this: class Person { public:
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and

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.