how to set border linear layout on top and bottom - android

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/home"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_marginRight="5dip"
android:src="#anim/linearsavelocationbackground"
android:weightSum="1" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="30dip"
android:layout_height="30dip"
android:layout_marginTop="15dip"
android:layout_weight=".2"
android:src="#drawable/homestatus" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_weight=".6"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:text="Home"
android:textColor="#3a3838"
android:textSize="15dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/homeimage"
android:layout_width="30dip"
android:layout_height="30dip"
android:layout_marginRight="5dip"
android:layout_marginTop="15dp"
android:layout_weight="0.20"
android:src="#drawable/deletingright" />
</LinearLayout>
<LinearLayout
android:id="#+id/office"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_marginRight="5dip"
android:background="#ffffff"
android:src="#anim/linearsavelocationbackground"
android:weightSum="1" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="30dip"
android:layout_height="30dip"
android:layout_marginTop="15dip"
android:layout_weight=".2"
android:src="#drawable/work" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_weight=".6"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:text="Home"
android:textColor="#3a3838"
android:textSize="15dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/homeimage"
android:layout_width="30dip"
android:layout_height="30dip"
android:layout_marginRight="5dip"
android:layout_marginTop="15dp"
android:layout_weight="0.20"
android:src="#drawable/deletingright" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
bacground for border
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="20dp"/>
<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>
<solid android:color="#CCCCCC"/>
</shape>
This is my code i am trying to display border top and bottom on Linarlayout but i am unable to show effect i have to set border top and bottom of home Linear Layout and office linear layout i am tried to set that but effect is not coming please check where am doing mistake.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="1dp">
<shape android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="#android:color/darker_gray" />
<solid android:color="#android:color/transparent" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>
Use the above layout as backgroud border. It will give you a very good effect. change the color and padding if you wish. Add this as xml in your drawable folder and make this drawable as background for the layout.
Hope this helps.

This can be done using an LayerList
Create a drawable name border_top_bottom.xml
<item>
<shape android:shape="rectangle" >
<solid android:color="#color/your_border_color" />
</shape>
</item>
<item
android:top="1dp"
android:bottom="1dp">
<shape android:shape="rectangle" >
<solid android:color="#color/your_fill_color" />
</shape>
</item>
On LinearLayout background property use
andorid:background:"#drawable/border_top_bottom.xml"

Add a xml in your drawable with the following code & then assign this xml as your linear layout background
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FF000000" />
<solid android:color="#FFDDDDDD" />
</shape>
</item>
<item android:top="1dp" android:bottom="1dp">
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#000" />
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>

I think Your problem is not Your shape, it is how You referred it inside the layout:
<LinearLayout
android:id="#+id/home"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_marginRight="5dip"
android:src="#anim/linearsavelocationbackground"
android:weightSum="1" >
You had set the reference to the anim folder, but it has to be in the drawable folder. If Your shape is inside the anim folder, put it into drawable folder and correct Your LinearLayouts src attribute:
android:src="#drawable/linearsavelocationbackground"
And then if this is not what you want, create a shape with the examples from krunal and EagleEye.

#Edge Please use this code
Let's say name of the xml file linearbg.xml and put it in drawable folder under resources.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="#EEEEEE" />
</shape>
</item>
<!-- This is the line -->
<item
android:top="1dp"
android:bottom="1dp">
<shape>
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
Now use this linearbg.xml as background in your linear layout as
android:background="#drawable/linearbg".

Related

How to make drawable circle shape with count

I really appreciate if someone can help me with using how to drawable circle view with count as like my below image.
I wrote some code for my requirement but it's showing rectangular shape but i want circular shape..
linear_layout_border(drawable file)
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#color/colorPrimary" />
<solid android:color="#color/colorLightSky" />
<padding
android:bottom="2dp"
android:left="10dp"
android:right="10dp"
android:top="2dp" />
</shape>
xml:
<FrameLayout
android:id="#+id/group_attachment_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="3dp"
android:background="#drawable/linear_layout_border">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/ic_group"
android:tint="#color/rosecolor" />
</RelativeLayout>
<TextView
android:id="#+id/members_count_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_marginBottom="3dp"
android:background="#drawable/test_circle"
android:gravity="center"
android:minWidth="15dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:text="0"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="visible" />
</FrameLayout>
image:-
Try this it looks as you want
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<corners
android:radius="10dip"/>
<solid
android:color="#2196F3" />
<stroke
android:width="2dip"
android:color="#FFF" />
<padding
android:left="2dip"
android:right="2dip"
android:top="2dip"
android:bottom="2dip" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="120dp"
android:height="120dp"/>
</shape>
Use this code to draw a circle and put it as background of your TextView and make its android:gravity="center"
Change height and width according to your need.
Try following drawable
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
<solid android:color="#58050505" />
<corners
android:topLeftRadius="3dp"
android:topRightRadius="3dp"
android:bottomLeftRadius="3dp"
android:bottomRightRadius="3dp"
/>
</shape>
</item>
</selector>
Use this for the TextView background
inside drawable folder
badge_background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#color/purple"
android:startColor="#color/purple"></gradient>
<corners android:radius="100dp"></corners>
<stroke
android:width="0.5dp"
android:color="#color/white" />
</shape>
The TextView
<TextView
android:id="#+id/serial_no"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="top|start"
android:layout_marginTop="5dp"
android:background="#drawable/badge_background"
android:gravity="center|center_vertical"
android:maxLines="1"
android:text="1"
android:textColor="#android:color/white"
android:textSize="13sp"
android:textStyle="bold" />

Pass color attribute from custom view to drawable shape in Android

I have created a custom view that uses two <shape>'s as background in the view xml. Right now I have hardcoded the <solid color=""/> of the shape, but I would like to pass the color as an argument from code to the custom view and forward to the shape.
How do I achieve this? I'd like to pass a color reference to both #+id/rectangle and #+id/triangle from code.
Shape:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp"/>
<solid android:color="#color/giddyologyOrange"/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size android:height="60dp"
/>
<stroke
android:width="1dp"
android:color="#C95800"
/>
</shape>
View:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/rectangle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/rectangle"
android:orientation="horizontal"
android:padding="5dp">
<ImageView
android:id="#+id/iconImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical|left"
android:contentDescription="Icon"
android:src="#drawable/iconplaceholder"
android:scaleType="fitCenter"/>
<View
android:id="#+id/spaceView"
android:layout_height="match_parent"
android:layout_width="10dip"/>
<TextView
android:id="#+id/labelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
android:textColor="#color/white"
android:gravity="center|left"
android:textSize="16dip"
android:maxWidth="150dip"
android:text="This is a really long text that should wrap"/>
</LinearLayout>
<View
android:id="#+id/triangle"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-1dp"
android:background="#drawable/triangle"
android:rotation="180"/>
</LinearLayout>
did you try this?
LinearLayout myView;
myView = (LinearLayout)findViewById(R.id.rectangle);
myView.setBackgroundColor(current_color);
I have a layout that has an ImageButton
<ImageButton
android:id="#+id/color_swatch"
android:layout_width="#dimen/standard_btn_width"
android:layout_height="#dimen/standard_btn_width"
android:background="#drawable/checker_tile"
android:contentDescription="#string/paint"
android:src="#drawable/paint" />
my src is a layer-list drawable--
layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<stroke
android:width="2dp"
android:color="#FF999999" />
<solid android:color="#00000000" />
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp" />
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="4dp"
android:color="#FF999999" />
<solid android:color="#00000000" />
<corners android:radius="0dp" />
</shape>
</item>
</layer-list>
the background is a layer-list drawable-
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial" android:gradientRadius="500"
android:startColor="#17568A"
android:endColor="#494C4F" />
</shape>
</item>
<item>
<bitmap
android:src="#drawable/checkerpattern"
android:tileMode="repeat" />
</item>
</layer-list>
I am able to setBackgroundColor to any color with 50% opacity and see the checkerpattern below
I ended up using a color filter to colorize the background image.
rectangle.getBackground().setColorFilter(color, PorterDuff.Mode.SRC);
Since the color comes from my model object this seemed like a pretty easy and maintainable solution.

How to create a xml drawable like this

I need to create a drawable with a 3dp height line/rectangle on top, a black rectangle with 70% opacity and 2dp height line/rectangle on the bottom. How can I do this?
Here is the code I'm using:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="0dp" android:left="0dp" android:right="0dp">
<shape android:shape="rectangle" >
<size android:height="3dp"></size>
<solid android:color="#C81F25"></solid>
</shape>
</item>
<item android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="#99000000"></solid>
</shape>
</item>
</layer-list>
PS: Ignore the gray gradient around the image, it's from Android Studio preview.
Case 1: Rectangle inside another rectangle.
Case 2: 3 Rectangles of which 2 are transparent which have negative paddings and strokes. On eclipse previews the case 2 shows wrong but it is correct and works when deployed.
case 1:
actionbarbg.xml in your drawable folder:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#F00" />
</shape>
</item>
<item android:top="3dp" android:right="0dp" android:bottom="2dp"
android:left="0dp">
<shape android:shape="rectangle">
<solid android:color="#9000" />
</shape>
</item>
</layer-list>
case 2: (sort of a hack)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#9000" />
</shape>
</item>
<item
android:top="-2dp"
android:left="-2dp"
android:right="-2dp">
<shape>
<solid android:color="#android:color/transparent" />
<stroke
android:width="2dp"
android:color="#C81F25" />
</shape>
</item>
<item
android:left="-3dp"
android:right="-3dp"
android:bottom="-3dp">
<shape>
<solid android:color="#android:color/transparent" />
<stroke
android:width="3dp"
android:color="#C81F25" />
</shape>
</item>
</layer-list>
Is it possible to build the layout without drawables using linearlayouts. I dont know which one of the two cases below you ment:
On the top layout there is a black alphamask with top and bottom margins of 2dp/3dp nested inside a red layout.
On the bottom layout there is a rectangle of 3dp height on top of a black alphamask and a rectangle of 2dp height below the alpha mask.
`
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginTop="3dp"
android:background="#9000" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>`
OR
`
<LinearLayout
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#C81F25" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#9000" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#C81F25" >
</LinearLayout>
</LinearLayout>`

Design XML Button Android

Here is an example of an app that used XML to design button.
How can i have the same design with XML?
How make my buttons look like it is floating just like in the image below?
I think you will need to use a shape drawable with a layered list, here is an example of a button that has a different color on the top and bottom (the drop shadow effect). You will set this as the background attribute of the Button.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<corners android:radius="2dp" />
<solid android:color="#color/button_border_dark" />
</shape>
</item>
<item android:top="1dp">
<shape android:shape="rectangle" >
<corners android:radius="2dp" />
<solid android:color="#color/button_border_light" />
</shape>
</item>
<item
android:bottom="1dp"
android:top="1dp">
<shape android:shape="rectangle" >
<corners android:radius="2dp" />
<solid android:color="#color/button_general_color" />
</shape>
</item>
</layer-list>
Here is the XML of the Button. You can also use custom typeface as well as shadows to make it the way you want.
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#android:color/holo_blue_dark"
android:textColor="#android:color/white"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_gravity="center"
android:shadowColor="#android:color/holo_blue_light"
android:id="#+id/btnClickMe"
android:text="Click Me!"
/>
Use this one....
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="#drawable/selected" // selected is the name of your custom file
android:text="Register"
android:textColor="#fff" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="#37a8f7"
android:text="Login"
android:layout_marginTop="15dp"
android:textColor="#fff" />
</LinearLayout>
you can make custom file selected.xml in drawable folder for red button.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000"/>
<corners android:radius="1dp"/>
<padding android:left="3dp" android:top="2dp"
android:right="3dp" android:bottom="2dp" />
</shape>
and set it to your red button.
And you can make same as for your blue button.

how to add bottom border in relativelayout

<LinearLayout
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:background="#drawable/settings_border" android:padding="1dp"
android:layout_marginLeft="15dip" android:layout_marginRight="15dip" android:layout_marginTop="5dip">
<RelativeLayout android:id="#+id/map_refresh"
android:layout_height="fill_parent" android:layout_width="wrap_content"
android:background="#drawable/settings_selector_up"
android:padding="15dp">
<TextView android:id="#+id/Text1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="Map refresh period">
</TextView>
<TextView android:id="#+id/TextView09"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="1 min"
android:layout_alignParentRight="true"
android:paddingRight="5dp">
</TextView>
</RelativeLayout>
<RelativeLayout android:id="#+id/own_location"
android:layout_height="fill_parent" android:layout_width="wrap_content"
android:padding="15dp"
android:background="#drawable/settings_selector_mid">
<TextView android:id="#+id/Text1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="Own location update period">
</TextView>
<TextView android:id="#+id/TextView09"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="1 min"
android:layout_alignParentRight="true"
android:paddingRight="5dp">
</TextView>
</RelativeLayout>
I want set only bottom border in relativelayout. I want to dispaly listview style but not using listview. Lets say each listitem is relativlayout. I want set only bottom border so its look like a listview's divider.
I hope I understood what you said.
in the res folder create a new folder (if you don't already have it) named drawable
there create an xml named "borders.xml"
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:angle="90" android:centerColor="#6da23f" android:endColor="#8bc45d" android:startColor="#2f481c" />
<stroke android:width="2dp" android:color="#999999" />
<padding android:bottom="4dp" android:left="3dp" android:right="3dp" android:top="6dp" />
<corners android:radius="10px"/>
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:angle="90" android:centerColor="#6da23f" android:endColor="#8bc45d" android:startColor="#4c8a39" />
<stroke android:width="1dp" android:color="#FFFFFF" />
<padding android:bottom="4dp" android:left="3dp" android:right="3dp" android:top="6dp" />
<corners android:radius="10px"/>
</shape>
</item>
</selector>
You can further edit it as you like.
Then select the layout from the Outline and click Background properties, and select the borders xml that you created.
This will create borders for all 4. Alternatively, you can add a simple
<View android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#FFFFFF" />
line and add it to the bottom of your layout and change the color/size to your liking.
For some reason the other solutions didn't work for me - all borders were shown no matter how I changed it. This worked:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#color/gray" />
<solid android:color="#color/gray" />
</shape>
</item>
<item android:bottom="1dp">
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#color/white" />
<solid android:color="#color/white" />
</shape>
</item>
</layer-list>
The color of the border is gray and the background is white for the container (LinearLayout in my example). You can simply change the second item to make the border thicker or have border on the top/left/right.
This is how the layout xml looks like:
<LinearLayout
android:id="#+id/searchWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#drawable/bottom_gray_border"
android:layout_alignParentTop="true">
<EditText
android:id="#+id/searchEditText"
style="#style/EditTextSearch"
android:hint="#string/find"
android:layout_marginLeft="5dp"/>
</LinearLayout>
I got the idea from here: Is there an easy way to add a border to the top and bottom of an Android View?
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dip"
android:color="#FF8000" />
<solid
android:color="#00FFFFFF"
android:paddingLeft="10dip"
android:paddingTop="10dip"/>
<corners android:radius="10px"/>
<padding
android:left="10dip"
android:top="10dip"
android:right="10dip"
android:bottom="10dip" />
</shape>
You can save this as borderframe.xml in the res/drawable folder (create it if it doesnt exist yet), and reference it like so: android:background="#drawable/borderframe".
A simple way to display a border is to create a horizontal LinearLayout, and to set its background color and height according to the border you want.

Categories

Resources