Border with the name around LinearLayout

I want to make a border with a heading around LinearLayout , as in this illustration.

layout http://img829.imageshack.us/img829/3461/borderwithtitel.png

I already have a border.
How to add a title?

I created the border by creating a .xml file in a transferable folder. There I made a shape, and then I set the background of the linear layout as this shape.

I am using API level 8.

+4
source share
2 answers

You might want to take a look at the layout of the Android framework.

A good tutorial can be found here or you can read dev.

+1
source

According to @Radu's answer, you can see an example:

 <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:color="#000000"> <View android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/rectangle" android:layout_margin="20dp" /> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:background="#000000" android:layout_marginTop="10dp" android:text="TITLE!" android:textColor="#ffffff"/> </RelativeLayout> </FrameLayout> 

And @ drawable / rectangle is in the popped rectangle.xml file as follows:

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@android:color/transparent"/> <stroke android:width="2dip" android:color="#ffffff"/> </shape> 
+1
source

Source: https://habr.com/ru/post/1447232/


All Articles