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
2 answers

How to correctly show Buttons in a LinearLayout inside a HorizontalScrollView?

I added a HorizontalScrollView with a LinearLayout, Buttons are added programmatically in order to show a category selector. This is the result in an emulator with API 23, 1080x1920 xxhdpi: This is how it looks in my Android phone with API…
Alejandro Lagos
  • 179
  • 5
  • 19
1
vote
2 answers

add LinearLayout within another LinearLayout through java

I have a layout that acts as a type of table which has two linearlayouts. The main linearlayout has vertical orientation and the one inside this one has a horizontal orientation. The code is below ... XML file ...
Saim Mahmood
  • 426
  • 2
  • 12
1
vote
6 answers

android Layout Spacing

I'm new to Android dev so sorry for what is probably a basic question.... I'm trying to get 2 textviews to appear at the top of the screen and take up an equal amount of space each BUT to have a margin of say 20dp between the 2 views and on the left…
Paul Hopkinson
  • 431
  • 1
  • 6
  • 14
1
vote
3 answers

Android: Center two elements in a Linear Layout

I want that both elements are centered and without that stretching. Also, it would be great if the weight was not that wide. This is how it looks like: Heres the…
1zz0
  • 264
  • 3
  • 18
1
vote
3 answers

Wrong width on Android fragment layout

I'm using NavigationDrawer and some fragments. I maked a simple example with an AutoCompleteTextView, but the width don't stretch with the screen size. Code of fragment.java: public View onCreateView(LayoutInflater inflater, ViewGroup container,…
Cassiano
  • 125
  • 1
  • 7
1
vote
1 answer

Moving CardView below the NavigationView

I'm looking to move the cardview down so it's not blocked by the navigation bar. Here's a screenshot to show what problem I currently have: Nav-Bar Covering Cardview. Any suggestions would be appreciated! Here is my activity_recycler_view XML…
1
vote
3 answers

Displaying two columns of a CardView in a LinearLayout

I am trying to fetch 3 sets of objects from my database and I want to display them in a fashion like this: but it's putting them only in one place rather than spreading out, see here: I am guessing that the cardviews are overlapping each other…
1
vote
0 answers

Xamarin : Issue with itemTemplate and focus

I have a listview with some Blocks. These Blocks contains 1 to 3 items with itemTemplate which are inside ResourceDictionary. Blocks and template are correctly displayed, but if I try to add or remove text from fields, it's impossible to edit…
1
vote
4 answers

Scrollview not working?

In my code scrollview is not working. When I directly call this layout scrollview works fine.But when I call this layout from another view this layout is not scrollable.
Mhandroid
  • 219
  • 3
  • 13
1
vote
1 answer

Trying to set top margin of linear layout programmatically

I am having LinearLayout inside scroll view. I want to set LinearLayout's top margin to 50dp programmatically using below code convertView = inflater.inflate(R.layout.apps_detail_item, parent, false); LinearLayout childLayout = (LinearLayout) …
Sapna Sharma
  • 460
  • 7
  • 22
1
vote
3 answers

Multiple fragments inside LinearLayout

Trying to place two fragments inside a LinearLayout with the following XML - MainActivity:
S.L.
  • 69
  • 10
1
vote
1 answer

How to change LinearLayout orientation many times in android?

I have problems with changing an orientation of LinearLayout many times in Android because in my scenario, I have a line number for changing orientation. In the other hand if numbers will be changing layouts orientation must be changed, but it…
Farzad
  • 212
  • 2
  • 6
  • 19
1
vote
1 answer

Android: Linear vs. table layout for a reusable UI component

I'm trying to define a reusable layout element I want to include in another layout. But I'm not sure what's the best way to archive the layout I want. The reusable component should look like this. It should be separated into 3 areas. Each area…
Flo
  • 27,355
  • 15
  • 87
  • 125
1
vote
3 answers

Android ScrollView Take whole device Space (Vertical)

My Fragment (FrameLayout) (w: match_parent, h: fill_parent) has two containing Layouts: ScrollView (w: match_parent, h: fill_parent) LinearLayout (w: match_parent, h: wrap_content) I'dont get, why the LinearLayout just overlays the ScrollView. I…
1
vote
1 answer

lines seen on screens near layouts in Android 7 Nougat

No issues below Android 7, but on Android 7 there are lines every where on my screens. Specifically where I have used LinearLayouts and weights. I have tested with two motorola devices with Android 7, those are 1- Moto G4 Plus and 2- Moto Z I have…
1 2 3
99
100