Defining an XML vertical line drawable

by Caspa » Mon, 19 Apr 2010 04:09:09 GMT

Sponsored Links

I'm trying to figure out how to define a verical line (1px thick) to
be used as a drawable.

to make a horizontal one, it's pretty straightforward:

<shape xmlns:android="" ;
    <stroke android:width="1dp" android:color="#0000FF"/>
    <size android:height="50dp" />

The question is, how to make this line vertical?

Yes, there are workarounds, such as drawing a rectangle shape 1px
thick, but that complicates the drawable xml, if it consists of
multiple <item> elements.

Anyone had any chance with this?


Defining an XML vertical line drawable

by patbenatar » Mon, 19 Apr 2010 17:37:55 GMT

 You could use a 1x1 Nine-Patch PNG....


Sponsored Links

Defining an XML vertical line drawable

by Caspa » Tue, 20 Apr 2010 23:49:39 GMT

 Thanks for the suggestion patbenatar!

I'm aware I could go for a 1px png drawable or draw the vertical line
as a View etc.

However since there is a "line" shape, I assume there is a way of
drawing it vertically, or at least there SHOULD be.

Can anyone confirm this being possible / not possible?


> >

Defining an XML vertical line drawable

by patbenatar » Wed, 21 Apr 2010 03:29:46 GMT

 Yea my idea is largely a hack... Always better to confirm no standard
method exists before pursuing hacks :)

> > >

Other Threads

1. Scroll Left and Right

I posted a question that I never got a response to.  I'm starting to
think what I'm trying to do must be impossible. I see a ListView that
allow me to go up and down.   As a consolation prize, is there any way
I can pan left and right even if it can't go up and down at the same
time?  If this isn't possible, then I assume I'll need to find another

See original question below...


- Mitch

From: Mitch
Date: Thu, 1 Oct 2009 22:54:17 -0700 (PDT)
Subject: Spreadsheet View

I've been trying to make a layout that displays something like a mini
spreadsheet that's specialized for my app.  I would like it to have
headers for both rows and columns.  The row header can only pan left
and right.  The column header can only pan up and down.

Hard to explain in words, so I'll try a picture (must be seen in a
fixed pitch font):

Stays| ... T3 T4 T5 ...
Row 3| ... 32 31  7 ...
Row 4| ... 17 21  9 ...

If the user pushes the image up the screen, row 3 goes away and row 5
appears but the header row stays.  If the user pushes the image to
left, column T3 goes away and column T6 appears and the header column

Having the "..." continuation hint would be nice, but is not

I would also like to be able to have more than 1 header row and
(the ones that stay fixed). The info in the upper left quadrant of
spreadsheet would always stay put.

It would be good to have the spreadsheet retain orientation in both
landscape and portrait to allow the user to choose if the rows or
columns would benefit from more display space.

A nice feature would be to let the user resize rows and/or columns.
This would be especially helpful for the fixed headers as display
space is at a premium.

I don't see anything that scrolls right or left nor anything that
would scroll both right/left and up/down as would be needed for the
lower right quadrant so I'm not even sure where to start.

I suspect nothing like this exists as a single view I can simple drop
into my xml, but how would I create such a thing by combining other
views?  Is there some other way through code to do his?

I'm new so simple hints are appreciated.  Thanks in advance.

- Mitch


2. relocating webview cache using softlinks

>> Why not just call clearCache() periodically?

And what happens when you fill up their SD card with your cache?

Why aren't you caching the data yourself, so you can control the location,
size, and retention policies of the cache? Conversely, why are you
electing to have those functions -- which are essential to the operation
of your product -- be delegated to a component (WebView's cache) over
which you have no real control?

Now, ideally, you could create your own CacheManager and WebViewDatabase
refinements, so you could leverage 90% of the existing logic and only
change what is needed to fit your business needs. Alas, I see no evidence
that you can replace the CacheManager/WebViewDatabase used by a WebView.

Mark Murphy (a Commons Guy)
Android App Developer Books:


3. Make different instances of a widget behave different based on their appWidgetId

4. relocating webview cache using softlinks

5. charting

6. Best way to drawing custom Bitmaps?

7. updating UI from runnable