Questions tagged [android-tablelayout]

The TableLayout is one of the layouts on the Android platform that arranges its children into rows and columns.

The TableLayout arranges its children into rows (the number of rows is given by the number of direct children, usually TableRows) and columns (where the number of columns is given by the TableRow with the biggest number of views in it).

Normally TableLayout consists of multiple TableRow objects, each defining a row. Each row has zero or more cells and each cell can hold one View. Cells can span over multiple columns. The width of a column is by default defined by the widest view in that column.

The TableLayout can also specify various rules to modify the way the columns use the space available to them (or even make them disappear). When using the TableLayout, care must be taken regarding the LayoutParams used as the TableLayout, which imposes some constraints on its children. More information can be found in the documentation for the TableLayout class.

This is an Android specific class, not present in JavaSE.

1224 questions
454
votes
11 answers

How to get the absolute coordinates of a view

I'm trying to get the absolute screen pixel coordinates of the top left corner of a view. However, all methods I can find such as getLeft() and getRight() don't work as they all seem to be relative to the parent of the view, thus giving me 0. What…
Steve Haley
  • 55,374
  • 17
  • 77
  • 85
238
votes
13 answers

Custom Adapter for List View

I want to create a custom adapter for my list view. Is there any article that can walk me through how to create one and also explain how it works?
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
141
votes
9 answers

What is the equivalent of "colspan" in an Android TableLayout?

I'm using a TableLayout in Android. Right now I have one TableRow with two items in it, and, below that, a TableRow with one item it it. It renders like this: ----------------------------- | Cell 1 | Cell 2 …
Spike Williams
  • 35,795
  • 13
  • 48
  • 60
91
votes
6 answers

TabLayout Tab Title text in Lower Case

I have used android.support.design.widget.TabLayout in my application with Min SDK 15. By default it takes Tab title in capitals but I want it to make in "textCapsWord". I tried adding Style as suggested here and here. But unfortunate both doesn't…
61
votes
4 answers

How to make a scrollable TableLayout?

Look at the XML code here please:
iTurki
  • 16,292
  • 20
  • 87
  • 132
46
votes
2 answers

Spanning columns with TableLayout

Possible Duplicate: What is the equivalent of “colspan” in an Android TableLayout? It says in the documentation for TableLayout "Cells can span columns, as they can in HTML." However, I can't find any way to do so. Specifically, I have one row…
Shawn Lauzon
  • 6,234
  • 4
  • 35
  • 46
36
votes
6 answers

XML Table layout? Two EQUAL-width rows filled with equally width buttons?

Here's a part from my XML for LAND format:
30
votes
2 answers

How to add border around TableLayout?

Below is my table code. My screen looks like this https://i.stack.imgur.com/U5ppn.jpg but I wanna make it looks like this https://i.stack.imgur.com/gFQZw.jpg. How can I add borders around each row and around table layout?
user2589245
  • 721
  • 2
  • 11
  • 23
26
votes
3 answers

ListView or TableLayout?

I am really confused now as to which one to learn. I am an iPhone app developer and now learning Android development. I have learnt how to use a ListView with a static array of strings using an Adapter. I am used to using custom cells in iPhone,…
23
votes
1 answer

What exactly does android:layout_column do?

Am learning android and am struggling to get my head around this particular layout attribute, reading the google dev docs it says: android:layout_column The index of the column in which this child should be. Must be an integer value, such as…
Alphatester77
  • 702
  • 3
  • 8
  • 16
21
votes
2 answers

Right align column in android table layout

I want to draw a table in which last column should be at the right most side of the table. This is how the table row looks like: Admin (2)New Network (2)New And this is how it should be: Admin (2) New Network (2) New XML:
Ankit HTech
  • 1,863
  • 6
  • 31
  • 42
21
votes
4 answers

create a chatView layout in android

I'm creating a chat application and I'm thinking on ways to create the actual chat view. I already have the layout for the chat window itself but I was thinking about how to implement the chat messages. I was thinking of creating a TableLayout and…
thepoosh
  • 12,497
  • 15
  • 73
  • 132
19
votes
6 answers

How can I highlight the table row on click ?

As my project requirement i have to highlight the table row on onClick. There is any way to do this? Or please suggest me the alternative?
Ravi
  • 211
  • 1
  • 2
  • 4
17
votes
1 answer

How to create a table in Android with multiple columns?

I want to create a table in android with multiple column. Most of the examples I saw is with 2 columns. (I am new to Java and Android.) I need 3-4 columns and I should be able to add the rows dynamically in the table. Can anyone provide me a sample…
narayanpatra
  • 5,627
  • 13
  • 51
  • 60
16
votes
3 answers

How to Inflate view from XML in Android?

I'm creating a tableLayout [given in XML] adding table Row [created in XML and inflating in Java] also adding 2 textview to the table Row [created in XML and inflating in JAVA] I'm able to get only the background and textcolors but not the layout…
1
2 3
81 82