Questions tagged [android-linearlayout]

LinearLayout is one of the basic layouts in Android. It arranges its children one after the another, either horizontally or vertically.

LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. You can specify the layout direction with the android:orientation attribute.

All children of a LinearLayout are stacked one after the other, so a vertical list will only have one child per row, no matter how wide they are, and a horizontal list will only be one row high (the height of the tallest child, plus padding). A LinearLayout respects margins between children and the gravity (right, center, or left alignment) of each child. More information about the layout:

4954 questions
1
vote
1 answer

Issue with collapsing toolbar in marshmallow and above

I am facing a little issue with Collapsing toolbar and only for the devices having OS marshmallow and above, for lower versions its working fine following is my layout
1
vote
2 answers

How to change layout orientation to vertical if all child views will not fit horizontally

I need to change the orientation of a Linearlayout depending on whether buttons would fit horizontally or not. For example, if we had two buttons that would fit within the total width of the screen, I would show them in a horizontal LinearLayout,…
Karen Forde
  • 1,117
  • 8
  • 20
1
vote
0 answers

Android include tag

We can merge layout using include tag in xml How to add include tag from code?? Because i want to change it in run time. Thanks.
user430926
  • 4,017
  • 13
  • 53
  • 77
1
vote
2 answers

Android Linear Layout Misalignment

I'm trying to use Linear Layout to create a simple layout with four elements in a row with 30dp fixed height. The elemens are a TextView, a Button, another TextView and another Button. However the second textview element is misaligned like it has a…
Joao Neto
  • 310
  • 3
  • 18
1
vote
1 answer

Android LinearLayout fill until bottom of screen

I have an Android activity that is composed by: FrameLayout > ScrollView > LinearLayout > ListView My ListView is my last component and I would like that its height size would go from the ending of the previous component up to the bottom of the…
Fabio Lanza
  • 167
  • 2
  • 5
  • 14
1
vote
1 answer

How do I get a border of a Linear Layout without losing my current background for the layout

I was looking at solutions to achieve a border for a linear layout but most required setting the linear layout's background to a custom made XML in drawable. What is the best way to achieve a border without setting the background? Or is there a way…
Cloin
  • 13
  • 2
1
vote
1 answer

Button not appearing if layout expands too large

I have what I believe to be a simple LinearLayout for an activity:
1
vote
1 answer

set height view to match parent with animation in android

How to change the height of the view to match_parent when there is a click? public class ResizeAnimation extends Animation { final int startHeight; final int targetHeight; private final boolean isOpen; View view; public…
1
vote
1 answer

How to access paren (LinearLayout) t of view during DragAndDrop using DragEvent.getLocalState()?

As illustrated above, I have 3 LinearLayouts, each has an ImageView and a TextView inside them. Each Image view has an OnLongClickListener attached to them. The AbsoluteLayout which encapsulates all the objects has an OnDragListener attached to…
1
vote
0 answers

How to arrange the chip in second row when the first row is filled in linear layout horizontal?

I am facing the problem in arranging the text view, i am dynamically creating the chips in a linear layout horizontal view, when i created the multiple chips only few chips are viewing the remaining are hidden,how to arrange the chips in second row…
1
vote
4 answers

How to set margin programmatically in android for a textview inside linearlayout?

I am trying to add margins for each textbox added to a linear layout, which is inside a scrollview. However big margins i set, it doesn't reflect on the UI. Why? I have referred quite a few things on this stack overflow itself. import…
1
vote
0 answers

Layout looking weird after marshmallow version

Hiii, I am working on custom layout. It's working perfectly on lollipop and below versions of android but later version showing weird look. How I want and showing in <= Android 5 How it's getting shown in >Android 5 Here is the sketch layout…
1
vote
2 answers

Difficulty in aligning child to the mostleft and mostright in-between another child

I want two images to be displayed on left and right and a textview in between them just at small distance to the left image but I couldn't get it done.
user7620502
1
vote
3 answers

Gravity center not working in LinearLayout

I have LinearLayout horizontal orientation.Height is 32 dp.I try to insert textview's text in center position, This is my source
BekaKK
  • 2,173
  • 6
  • 42
  • 80
1
vote
2 answers

How to set dynamically the width of button according to its text content in android?

I want to have button size according to the text content. For example, if size of text is about 4 letters then width of button be should big enough to adjust 4 letters only.Here is My Code: layout = (LinearLayout)…
Priya singh
  • 87
  • 1
  • 9