Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Android: Filler / Divider Between Columns in a TableLayout

DZone's Guide to

Android: Filler / Divider Between Columns in a TableLayout

· Java Zone
Free Resource

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

Android is pretty tricky to deal with at times, and surprisingly difficult for something very simple..
..like adding a filler between columns in a TableLayout. "Gotta be simpler!" I thought after having spent countless minutes reading up over countless  suggestions and  recipes.
So I took the path of just creating an empty filler.png image in the mspaint, just a vertical bar, and inserting it programmatically:
ImageView dividerView = new ImageView(this);
dividerView.setImageResource(R.drawable.filler);

Then added this to a TableRow object which subsequently should be added to the aforementioned TableLayout.


Before adding a divider:



After adding a divider:

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Published at DZone with permission of Dmitry Kan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}