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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:32:08+00:00 2026-05-31T09:32:08+00:00

I recently made my first custom shape and it turned out really good accept

  • 0

I recently made my first custom shape and it turned out really good accept one thing. i can’t seem to set the height and with of the drawable resource in a style resource.

I do not specify a height or width in på shape because i want to use this shape in different sizes. So i set height and width in my styles.xml file. But the final result is what looks like the shape using wrap_content as both height and width which i do not want.

Any help is greatly appreciated!

SHAPE – list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle" >

        <solid 
            android:color="@color/list_item_background"
        />

    </shape>
</item>
<item>
    <shape android:shape="rectangle" >

        <gradient 
            android:angle="270"
            android:startColor="@color/list_item_gradient_white"
            android:endColor="@color/list_item_gradient_black"
            android:type="linear"
        />

        <stroke 
            android:color="@color/list_item_stroke"
            android:width="1px"
        />

    </shape>
</item>

STYLE

<style name="SmallListItem">
    <item name="android:background">@drawable/list_item</item>
    <item name="android:layout_height">69.5dip</item>
    <item name="android:layout_width">fill_parent</item>
</style>
  • 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-31T09:32:09+00:00Added an answer on May 31, 2026 at 9:32 am

    Try something like this:

    <ImageView
        style="@style/SmallListItem"
        android:src="@drawable/list_item" />
    

    See http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList for more information on how to use your layer-list

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

Sidebar

Related Questions

I recently started learning about HttpModules and made my first one. I was wondering
I recently made this wordpress blog, where you can sign up a team for
Having made the jump just recently from XEmacs to GNU Emacs, I'm really loving
I recently made a simple game where user can submit his/her high scores online.
Recently we made the first branch of our project's trunk. The trunk is rather
I recently made my own Javascript library and I initially used the following pattern:
I recently made a c# printer management tool that uses a WCF service which
I recently made an update to JasperReports library version 4.1.3. Previously, I had a
I've recently made another question about connecting to MS-ACCESS database with .NET in C#
Hi I have recently made this script to rename files I scan for work

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.