1

This is my first question so pardon any convention I might have unknowingly overlooked.

Now, I want to create a long table in which each element has centrally positioned textview and below it, three textviews side-by-side. I have tried TableLayout, which makes the cells aligned (and I dont want that). I have tried LinearLayout which makes it appear either vertical or horizontal, not the kind of mixture of both that I need. I tried RelativeLayout which happens to be too cumbersome and I still couldn't get my result. Most probably, am making a conceptual mistake somewhere. All this is to be done programmatically. Can somebody help?

braincrash
  • 57
  • 1
  • 3

1 Answers1

1

How about putting a TextView and a Horizontal LinearLayout containing three TextViews in a Vertical LinearLayout or a RelativeLayout?

<RelativeLayout>
    <TextView
        android:id="@+id/txt"></TextView>
    <LinearLayout 
        android:orientation="horizontal"
        android:layout_below="@id/txt" >
        <TextView></TextView>
        <TextView></TextView>
        <TextView></TextView>       
    </LinearLayout>
</RelativeLayout>

OR

<LinearLayout
    android:orientation="vertical">
    <TextView></TextView>
    <LinearLayout 
        android:orientation="horizontal">
        <TextView></TextView>
        <TextView></TextView>
        <TextView></TextView>       
    </LinearLayout>
</LinearLayout>

Hope this helps.

P.S: I haven't added id, width, height, text etc. :) Just a structure.

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
  • Thanks a ton. Solved in 5 minutes. So any kind of views can be nested in any manner? Always? Am 1-week old in android so didn't know about nested views. – braincrash Sep 08 '14 at 11:57
  • Yes, @braincrash you can nest them and create any layout you want to :) good luck.. – MysticMagicϡ Sep 08 '14 at 11:57