Add border to linearlayout android xml contains ScrollView as parent layout and main LinearLayout as child if no row item more screen size ScrollView handle overflow item with scroll:. google. following code works fine for me but here it is displaying data with out borders but i want to display data with b Sep 14, 2013 · I have read other questions about adding a vertical line in Android, here's my questions I was able to add a vertical line as a "View" under my main RelativeLayout Jul 15, 2022 · Since there is no change in the Java/Kotlin MainActivity File, we’ve only provided the XML File Code. Here is the xml of the scroll view &lt;ScrollView android:background = "@drawable/border" android:layout_ Aug 28, 2013 · Add a comment | 2 Answers Android LinearLayout with border of transparent pixels. 2. Layout1); ImageView image1 = new ImageView(getApplicationContext()); String uri = "@drawable/myresource. id. Check if @drawable/MovieHopBackground has any probs that might cause this issue. setLayoutParams(new LinearLayout. Actually i want to change the open source code of android such that the background of linear layout changes that means whenever we are accessing linear layout in application level then linear layout with my specified background should be displayed – Aug 5, 2016 · To add a border to Android TextView we need to create an xml containing shape as rectangle file under drawable's folder and set it as background to the TextView. I would like to add to selected templates right and bottom border. Here is my code that display the inner color black. Custom rounded linear layout : add borders. floatingactionbutton. I want to show you how to draw border with different colors on each side of a layout. Then place the Edit text inside this Linearlayout and give some background color. but, I have a constraint layout inside which so many sub layouts I have, which resembles a edit text view with feature like editing particular set of values by locking editing of other values. Android: drawable Feb 7, 2021 · Ah, that can be achieved by using BottomAppBarTopEdgeTreatment. The normal layout xml is <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> </LinearLayout> Option 2: Background View Another option is to use a background View to create the border. You could apply android:background="@drawable/border" android:padding="10dip" to each of the LinearLayout from your provided sample. I have some LinearLayout in my XML file. 2 and ran perfectly as shown in image below : Finally its works perfectly with all APIs Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Apr 23, 2013 · For API 21+, Use Clip Views. &lt;LinearLayout android:i Jan 29, 2013 · I'm trying to place a border around a LinearLayout, however it only appears on part of it. Nov 29, 2018 · I want to make the whole view (linearlayout) with rounded corners. Jul 13, 2011 · oh and one more thing :-) LinearLayout basically (basically!) doesn't change position of views unless you force it to, meaning if you add them before other views so if the view was empty you can be sure that each index is i = 0; and i +1 for each new item you add, in addition if you use more then 8-10 items i think ListView would be better Jul 10, 2013 · There's no concept of borders as an attribute. Oct 26, 2016 · I am working on a Tic-Tac-Toe. <?xml version="1. The border should be external to framelayout and should not consume the space inside of framelayout. Aug 25, 2015 · You can add a new ImageView to your RelativeLayout, set the height to 1 px, align it to the bottom, then this ImageView can be 'considered' as the border. 6. android. - LinearLayout(horizontal) - ImageView - LinearLayout(vertical) - TextView - TextView - TextView - TextView Jan 21, 2014 · To set the border in ListView set the property android:divider="@drawable/img_list" and android:dividerHeight="1px" to set the height of the divider. 0" Apr 1, 2015 · In my app two button arranged vertically in LinearLayout. I coul Mar 13, 2020 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand You can add top border by creating a new LinearLayout with a View for top border and place android. edit_text_back);, but it does not work. xml" I'm able to draw border to a linear layout, but it is getting drawn on all sides. here is my card. Example for the bottom border line: <LinearLayout android:orientation="vertical" android:layout_width="fill_parent Oct 22, 2012 · How can I show shadow for my linear layout. Hot Network Questions Jul 30, 2019 · How do I put a border around an Android textview - If you wants to see text view as 3D view as we seen in Microsoft power point 3d texts. Here is the working code. It seems like it should be very simple but I can't seem to Dec 19, 2018 · I have a floating button with full white background tint and an image source. That's value I have got through JSON of background color and border Apr 12, 2016 · I am implementing card view but I can't find any border option to set a border on it. OnTouchListener { static final String logTag = "ActivitySwipeDetector"; private Activity activity; static final int MIN_DISTANCE = 100; private float downX, downY, upX, upY; public ActivitySwipeDetector(Activity activity){ this. v7. What is the standard way to implement this effect? This is the code of the linear layout under which I want to add this effect: I am developing Android v2. widget. Th Nov 30, 2011 · I hope I understood what you said. For example, feel free to modify. Please help. How can I accomplish this? Any sugges Jul 28, 2013 · I'm working on Gesture activity in android I used class to detect the swipe action is . This example demonstrate about how do I put a border around an Android text view. Link donate : http://paypal. &lt;LinearLayout android:i May 3, 2012 · Though all the provided answers work,they are very rigid. But read the bottom answer as well, I had success by adding 2dp padding (the same width as the border. <RelativeLayout> <TextView android:layout_alignParentTop="true" android:layout_margin="20dip/> <LinearLayout> // here is your linear layout </LinearLayout> </RelativeLayout> Apr 22, 2013 · You should use a ShapeDrawable for the background of the component you want to add the style to. - In this video, I show you How to Add border with shadow around a LinearLayout in project android. pleas see following xml: I came here looking to learn how to add a View to a specific location relative to another child View to be dynamically determined. Jul 21, 2013 · android; android-layout; or ask your own question. Hot Network Questions Feb 18, 2016 · I have a cell with a fixed width and height, let it be 100x100px. design. I've just created a normal FAB. May 7, 2018 · In my application i am using the following code for display content in table view. How? Let's see. I've just set image resource and icon border color. Toolbar&g Jun 6, 2019 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Mar 24, 2015 · Android LinearLayout : Add border with shadow around a LinearLayout. /&gt; tag. Since Android Design Support v28 was introduced, it's easy to create a bordered button using MaterialButton. May 23, 2016 · Here's how to do it correctly. Add <solid android:color May 29, 2012 · Android LinearLayout : Add border with shadow around a LinearLayout. How to make border of LinearLayout in android as per following design. Where should i add this. Android - adding custom border to image view. xml. setColor(Color. The shape is such that the stroke on the shape outline appears as border. So far ive managed to give the layout rounded corners but i cant figure out how to give it a blurred backgr As you can see in the previous image, under the first linear layout (the one that contains the menu and the April 2017 date) there is a shadow. 3 and ran perfectly as shown in image below: ALSO. 0. Here is my Code: TableLayout table = (TableLayout)findViewById(R. In the onCreateView() callback of my fragment class, I inflate an layout to the fragment like below: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater. constraintlayout. The divider just doesn't show. implementation 'com. Jun 17, 2014 · As an example of the answer, below is the code. FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android Apr 5, 2018 · I want to set transparent background color on LinearLayout. In the above File, we have used an inner Relative layout with the drawable file we have set the background property of the inner relative layout as rounded_shape drawable so according to that file, the layout would be drawn on the screen. Apr 25, 2019 · CompileSdkVersion 26, if it's important. What you need to do is. I don't find any way to do so. GRAY); paint. ) Sep 17, 2012 · Then add textview in relative layout and mention that textview is on top and give marign. GridLayout android:id android: How to add shadow to linear layout - android?Thanks for taking the time to learn more. All this view looks lik In my android application I have to implement something like the image given below : I have tried using shadow xmls for a linear layout but it doesn't seem to work out the way i want it to be. You can add radius to your layout. Could someone please help me? Apr 14, 2015 · I am trying to figure out how to put a border around multiple views for an android app I'm working on. in the res folder create a new folder (if you don't already have it) named drawable. I use this layout to get an appBar (details hidden): &lt;android. Mar 24, 2013 · I am creating an application and posted a question yesterday how to start activity by click any where on row. STROKE); paint Jul 11, 2014 · That isn't the correct way to implement a custom View class. I have found many codes but I couldn't get what I need. setBackgroundDrawable(getResources(). I want to add a thin gray border around each item as well as a soft rounding if Nov 25, 2014 · layout1. Every solution I have tried so far change the color of all the LinearLayout, not just the border. Wrap the fragment map with a linearlayout, and put the border in the linear layout. I have done this so far. TitleLayout. I've tried this, but it Dec 16, 2016 · I need to set a border to a LinearLayout when the user click on it. In order to create a border around your table rows and around the table layout, you need to create a drawable to serve as a border and then set it as a background to your rows. In this example the existing single TextView is moved onto the LinearLayout. My first idea was to put a background resource to the ImageVi I have the following linear layout, which is used as table cell. Jun 12, 2017 · I have a recyclerView currently set up to add a drop shadow to the bottom of each item with spacing which works well. Here's what I did: Aug 23, 2013 · Total programmatic approach to set rounded corners and add random background color to a View. The Activity begins by creating the necessary LinearLayout (lines 13-16) and applying its border (line 16). Please provide a solution my layout as follows Abhinav's answer is right on, I'm just adding this additional info for absolute beginners like myself who encounter this answer and don't even know yet how to "enclose the WebView in a Layout" or "add the border to the Layout"; hopefully it can help someone: Mar 19, 2013 · Rewrite. Got an idea to do like below but I am getting this error:. support. Since the LinearLayout covers all the CardView, then the whole view, is the CardView. I couldn't find any standard way of doing it, so I came up with this: @drawable/custom_bg_1: A blue rounded shape &lt;?xml version="1. material. The problem is: as far as I have googled, I can achieve only one out of both. Please, do not use @android:color/white in your final application but rather a project defined color. example: Create a file called customborder. 0. I am a total newbie with Android. getPaint(); paint. I want to surround it with a grey border. You have to create an Activity for each tab (which is logical since each tab should be able to stand alone as its own page). An ItemDecoration allows the application to add a special drawing and layout offset to specific item views from the adapter's data set. The framelayout is used as container for the fragment. Nov 24, 2015 · In Android, when you define your user interface in XML, you can define a border for layouts. Use the below code to set the border of EditText. This is my layout: &lt;LinearLayout android:layout_width="match_parent" android:layout_height="210dp" and Sep 15, 2015 · I tring to make shadow around linearLayout like on image below (on top): I`m using layer-list with shape, but all bottom shadow owerlapping by white area (see image above). layout. Mar 22, 2013 · I am new in Android Application development, I want to create one application where I can add borders or frames to the images in the gallery or to a new picture taken from camera, I have searched t I used this example and tried to add it to my edit text programmatically like editText. This is one "row" for the EditText and button, so a horizontal layout. there create an xml named "borders. The XML, the draw function and the main Activity. Instead, you need to extend ItemDecoration, a RecyclerView's inner class:. To draw a border around TextView, you can use background attribute of the TextView widget and assign a shape to it. Sep 8, 2011 · I have tried to draw a horizontal line at the BOTTOM of my linear layout. However, these borders are rectangles by default. Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Jul 17, 2014 · I am trying to add a top border to a LinearLayout with a transparent background. recyclerView. Feb 14, 2014 · Change android:layout_width="0" to android:layout_width=0dp in Relative Layouts. Oct 7, 2013 · I want to set set the border color white for linear layout but no inner color. png"; // Here you can set the name of // the image dynamically int imageResource = getResources(). Mar 7, 2013 · I think the guide explains it pretty clearly. I draw borders by following codes. login, null); return view; } Oct 30, 2020 · I need to achieve the style like below. LayoutParams params = new LinearLayout. findViewById(R. Tip: If required use the Component Tree to move Views and Widgets around. me/lirstechtips Adding a border with a shadow effect to a LinearLayout can enhance the visual appeal and user experience of your Android application. I realize the question doesn't directly ask that, so rather than make my own answer, I'll just add to this one how one would do that: first use ViewGroup. You want that hierarchy programmatically. linear_Layout_List); Tabl Dec 14, 2016 · I need to set border to linearLayout without modifying it's size, I try setting in the background of linearLayout some drawable with border and padding but this one is set inside of the linearLayou Dec 16, 2016 · I need to set a border to a LinearLayout when the user click on it. Feb 17, 2015 · First I make a border of Linear Layout using ShapeDrawable then I have try to set background color on LinearLayout but color is not set then I have comment two line of ShapeDrawable then after I have set the background color of Linear Layout but problem occur in border color. Thus I want to display fragment with a border. The result should be like the following image, where the border is the top border of the "Jp Project" LinearLayout. Oct 11, 2016 · No need to re-define the layout entirely within Java. 1. Unlike ListView, the RecyclerView class doesn't have any divider-related parameters. Generally adding a border shouldn't be a problem, but the border in. inflate(R. Keep the cornerRadius param same for both the cards: Mar 14, 2022 · Try this: <com. 2 app. May 28, 2013 · so the question How to add border around linear layout except at the bottom? answers my question partially but i cant seem to figure out how to make the corners round Oct 7, 2011 · • Android Official Solution. I want white colored rounded background with shadow around the linearlayout. you can add the image view to the linear layout. border)) EDIT : Since Jelly Bean, this method (setBackgroundDrawable has been deprecated), so yet you have to use this one : May 5, 2012 · Then add a background to your linear layout like this: android:background="@drawable/border" EDIT : This XML was tested with a galaxy s running GingerBread 2. See this training doc or this reference for more info. You have obviously read: How do you put a border around a ListView? since you are using the code from the better / more popular answer. May 27, 2013 · I wanted to add a linear layout, having a transparent background as well as with white borders. I want to restrict it to right side only, like you do in CSS (border-right:1px solid red;). Oct 14, 2016 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Aug 16, 2010 · The simple way is to add a view for your TextView. I created 2 LinearLayouts, one with corners, and one with color, but their shapes I have three files. (This Android border tutorial assumes that Android Studio is installed; a basic App can be created and run; and code can be correctly copied into Studio. 224. Remember to consider performance implications and choose the most appropriate approach based on your specific requirements. Inside that cell I want to display an ImageView with a border around. Code: LinearLayout li=new LinearLayout(getActivity()); li. Is there something I have Vertical ScrollView where I am going to add some Views after a buttonClick. In your implementation of the Card class, you're actually creating an additional LinearLayout that is not needed. 18. then add this to linear layout as backgound as this: android:background="@drawable/border" Programmatically. 1 - Create shape drawable with stroke 2 - Create ripple drawable 3 - Create selector drawable for less than v21 4 - Create a new style for button with border 5 - Apply style on button Feb 20, 2013 · Is there an easy way to add a border to the top and bottom of an Android View? There is no built-in "border" concept in Android that I can think of. This tutorial is made for […] I’m attempting to create a layout border with corners that are square on the outside and round on the inside. Here is my linear layout file: <LinearLayout android:id="@+id/test" android:layout_width="fill_parent" android:layout_height="wrap_content> <ImageView android:id="@+id/icon1" android:layout_width="32dip" android:layout_height="32dip" /> And I did add Basically, you need to create a custom drawable and add it as a background to your layout. How to give layout rounded corners Android. Rounded outline clipping was added to the View class in API 21. Apr 25, 2017 · None of the Above answers worked for me . Aug 12, 2013 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Sep 23, 2013 · So I wanted to have a TextView with a cool border around it. Dec 26, 2020 · I want to overlay my LinearLayout with rounded corners on top of ImageView but there is still white color in background. what if you want to customise border color,borderthickness for different screens. to my linear layout. android-layout; android Dec 10, 2010 · The best way to create a shadow is to use a 9patch image as the background of the view (or a ViewGroup that wraps the view). This in-built feature makes rounded corners very easy to implement. I have not tested the code, but you get the idea. &lt;LinearLayout android:orientation=&quot;horizontal&quot; android: Apr 24, 2015 · I am trying to add a custom border to a framelayout. May be, you could want to create a layout with rounded corner borders. OnClickListener) in the type View is not applicable for the arguments (new OnClickListener(){}) Apr 25, 2016 · I want to set thick border color at bottom of linear layout programmatically. 1. I’ve gathered that I need to create an . And sometimes the border is required in one of the combinations of all sides (by including or excluding some). xml file, but you don't need any border in layout the no need to add anything. layout1. However, i want to add a border to my GridLayout(Board) Here is the following code of my gridLayout &lt;android. material:material:1. LayoutParams( Apr 28, 2018 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Aug 19, 2011 · I have a question that how to give cell borders in tablelayout of Android programmatically. xml in your drawable folder: <?xml version="1. Hope it helps! Apr 20, 2014 · I'm having a problem with my view if I try to display an image as background, it took the whole space and the second child of linear layout (2 RelativeLayout that appears next to each other) does not May 26, 2014 · I have developed a custom rounded LinearLayout and I want to add 1px border. In this example project a simple Android shape is used to add a rectangular border with rounded corners to a layout file. You know how to achieve that in CSS but you don’t know how to make that in Android. for that you should try my solution. You can emulate one through layouts, such as: Wrap the TextView in a LinearLayout and add a plain View above and below it, with the Views having the desired android:background color and an Jun 7, 2014 · Can anyone explain how to add bottom border to relative layout programatically? PS: I'm using below code for adding border to relative layout:. Linear Layout does not add any border by default, if you need to add border then you can use drawable . tested with galaxy s 3 running JellyBean 4. Note that you'll need to relate android:padding of the LinearLayout to the android:width shape/stroke's value. Feb 28, 2013 · I'm trying to add a divider to a horizontal linear layout but am getting nowhere. Here my code : public class MyLinearLayout extends LinearLayout { private float radius; private Path path = new Path(); Feb 10, 2012 · You can create a linearlayout with background color the color which you want the border should be. How to create a border around linear layout like the image below? 0. This is my layout XML: &lt;RelativeLayout xmlns:an Jul 3, 2012 · How to add border around linear layout except at the bottom? 147. This class supplies updated Material styles for the button in the constructor. 0' Jan 19, 2015 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Jan 21, 2010 · IF you are just trying to have a line in between rows (for example, just above a "Total" row) then there is an easy solution - just add a TableRow with a background color and a specific layout_height such as this: Jun 28, 2018 · Add below code to set divider line for GridLayoutManager of RecylcerView. 3. &lt;LinearLayout android:layout_width="fill_pare Mar 20, 2013 · I want to create a layout with rounded corners and a filled color background. xml TextView Border. Or how to display the border. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. xml drawable definition composed of two shapes: Mar 10, 2012 · I would to know how to have a border to separate my buttons in my xml file. This blog post will guide you through how to achieve this using an XML drawable file, providing a step-by-step explanation of the solution. A shape drawable is created in XML, with the following syntax (this one shows a rectangle, with the rounded corners, but there is lots you can do to customize this to look however you want). Add this if you haven't already. Dec 9, 2016 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand I am trying to add a linear layout with rounded corners and blurred background in my app. It only puts the border around the TextView seems to stop at an &lt;include . Oct 6, 2012 · How to set a background color for linear layout programatically? I tried following code but not working: LinearLayout footer = new LinearLayout(activity); footer. BottomNavigationView below top ber View. Jul 3, 2020 · This example demonstrates how to add a border to the top and bottom of an Android View . Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. First, create a function like this which returns a MaterialShapeDrawable which you can set to the LinearLayout as: Jan 31, 2012 · I am new to Android. drawable. Now I have a problem about drawing borders on LinearLayout. So instead of setting transparent background to the CardView, set it to the LinearLayout, set a background color to the CardView and you will see rounded corners. The accepted way is to use a separate drawable as the background to the View (using stroke as you've mentioned and as @gunaseelan writes). Apr 22, 2021 · At some point there is a need to display a layout with border(s). This involves adding a View with a black background behind your main View and setting the padding of the main View to show the border. setStyle(Style. I suggest you have a look at this. CardView android:layout_marginTop=&quot;10dp&quot; android Aug 26, 2015 · I have the requirement that the appBar should look like this: The background is simply transparent. getIdentifier(uri, null, getPackageName Feb 21, 2011 · The other way to do it is to create a border resource that can then be reused, and it also means you won't need to create extra layout to implement it. Such as Divider and DividerHeight of ListView. LinearLayout is one of the most common controls, mainly for typographic layout, I will introduce how to add a border pattern to linearlayout, and the effect before adding styles is as follows: It can be seen, each linearlayout is almost all connected together, the visual effect is poor, let's write a style for this, like a CSS style sheet: Basically, you need to create a custom drawable and add it as a background to your layout. public class ActivitySwipeDetector implements View. Feb 18, 2015 · The code for the main Activity is shown below and does not require any external layout files as everything is done programmatically. I have a TextView and I'd like to add a black border along its top and bottom borders. And in your fragment map, add margin Aug 31, 2016 · I am working on an Android application in which I have a ListView for which I would like to add a border for each row in ListView. i want to provide a gap between two buttons. First you're using pixels (px) instead of device independent pixels (dp) Doing things like this create UIs that only work for specific device screen configurations. setBackgroundResource(R. I'm trying to make a dotted line. I want to create LinearLayout with rounded corners, and background color. Call it ingredient_input. Next, Remove <stroke android:width="2dp" android:color="#FFFFFFFF" /> from your shape. The first step is to create a png image with a shadow around it. View LinearLayout1 = findViewById(R. 0" encoding="UTF-8"?> Drag and drop a LinearLayout onto the screen and set the border background (android:background="@drawable/customborder"). By extending LinearLayouts and creating custom views, you can easily add borders and circles to enhance the visual appeal and functionality of your Android applications. . We are going to follow three steps in creating a custom RelativeLayout that allow you to provide borderColor and Thickness for bottom border. How to remove that? activity_main &lt;androidx. I tried adding android:drawableTop and android:drawableBottom to the TextView, but that only caused the entir May 28, 2012 · You shouldn't be doing this. I'm using this right now for a solid line: LinearLayout divider = new LinearLayout( this ); LinearLayout. borderEffect); ShapeDrawable rectShapeDrawable = new ShapeDrawable(); Paint paint = rectShapeDrawable. The method setOnClickListener(View. public class Borders{ int w; int h; public Borders(int x, int y){ May 21, 2013 · I have linear layout in which i have to apply border,border radius and background image. You should define it as its own XML file. I have a Fragment. If you want to simulate a translucent border that doesn't overlap the shape's "solid" color, then use this in your xml. My solution is Use a card inside a card with outer card with the border color . Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Jul 31, 2021 · How to add a shadow border on 4 sides of an edit text as shown in the image? Applied below code but it creates a shadow on single side only. 0" encoding="UTF-8"?> Feb 13, 2016 · As the accepted answer requires you to add a Frame Layout, here how you can do it with material design. Jul 16, 2010 · This is an old post I know, but I thought this might possibly help someone out there. In this video I'll go through your question, provide various As per my understanding if you want to make overlapping view (like the bookmark one, as depicted in your question), you should use ConstraintLayout rather than using LinearLayout or RelativeLayout or any other layout as because by using ConstraintLayout you can easily create overlapping views and use them. 0&quot; encoding=&quot;utf-8&qu Apr 7, 2011 · @swathi:the answer you have insisted is valid for application level only but not in framework. indexOfChild(View view) to get the index of the other View, then use the addView method with the index detailed Jun 29, 2019 · As you want to set the image dynamically, on the button's click. xml: <android. RelativeLayout layout = (RelativeLayout) view. addItemDecoration(new GridLayoutItemDecoration(2)); Use below GridLayoutItemDecoration class. But now I'm able to add only border on right. I haven't set gray background color but linearlayout's background looks gray. getDrawable(R. How to add a shadow above a view in android. activity = activity; } public Aug 23, 2015 · How can I add a border on the inside of the following LinearLayout on the left side, such that it's 5dp wide and fits the entire height of the LinearLayout? The height of the LinearLayout is dynamic, Aug 21, 2012 · How to set border of GridView. douxa hqm blh fwvd pil akfahhv zyjet jpr dcirvha qdetigp