Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add heading to a Linear Layout

Tags:

android

border

I have to create A GUI like below. I have used LinearLayout and created the border around it.I have to insert the header text between the border. Any idea how to do this.enter image description here

like image 989
Nishant Avatar asked Oct 07 '22 15:10

Nishant


2 Answers

<RelativeLayout>)
    <LinearLayout with border>
    <TextView with white background>
</RelativeLayout>

The TextView should appear above the linearlayout covering the border with his white background. You could position it using margins.

like image 103
ePeace Avatar answered Oct 10 '22 01:10

ePeace


use relative layout as parent and put all your linearlayout code under relative layout. Then add textview in relative layout and mention that textview is on top and give marign.

  <RelativeLayout>
     <TextView android:layout_alignParentTop="true"
      android:layout_margin="20dip/>
     <LinearLayout>
                // here is your linear layout
     </LinearLayout>
   </RelativeLayout>
like image 23
knvarma Avatar answered Oct 10 '22 03:10

knvarma