How to set border at bottom for linear layout programactically in android -


i want set thick border color @ bottom of linear layout programmatically. have found many codes couldn't need.

code:

linearlayout li=new linearlayout(getactivity()); li.setlayoutparams(new linearlayout.layoutparams(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content)); li.setorientation(linearlayout.vertical); 

thanks.

you should create xml file (border.xml) in drawable folder creating border :-

<?xml version="1.0" encoding="utf-8"?> <inset xmlns:android="http://schemas.android.com/apk/res/android"     android:insettop="-2dp"     android:insetright="-2dp"     android:insetleft="-2dp">      <shape android:shape="rectangle">         <stroke android:width="1dp" android:color="@color/ora" />         <solid android:color="#d3000000" />     </shape>  </inset> 

and set background dynamically using line.

li.setbackgrounddrawable(r.drawable.border); 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -