Questions tagged [layout]

The layout tag is for questions about the placement, alignment and justification of objects with respect to a containing element. For questions pertaining to CSS, use the 'css' tag instead.

In computing, layout is the process of calculating the position of objects in space subject to various constraints. This functionality can be part of an application or packaged as a reusable component or library.

Android Development Examples:

HTML Examples:

26721 questions
354
votes
12 answers

How can I swap positions of two open files (in splits) in vim?

Assume I've got some arbitrary layout of splits in vim. ____________________ | one | two | | | | | |______| | | three| | | | |___________|______| Is there a way to swap one and two and…
wes
  • 7,795
  • 6
  • 31
  • 41
351
votes
17 answers

How do I center a SVG in a div?

I have a SVG that I am trying to center in a div. The div has a width of 900px. The SVG has a width of 400px. The SVG has its margin-left and margin-right set to auto. Doesn't work, it just acts as if the left margin is 0 (default). Does Anyone know…
Don P
  • 60,113
  • 114
  • 300
  • 432
351
votes
5 answers

How to get controls in WPF to fill available space?

Some WPF controls (like the Button) seem to happily consume all the available space in its' container if you don't specify the height it is to have. And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more…
Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75
348
votes
6 answers

Fill remaining vertical space with CSS using display:flex

In a 3-row layout: the top row should be sized according to its contents the bottom row should have a fixed height in pixels the middle row should expand to fill the container The problem is that as the main content expands, it squishes the header…
Zilk
  • 8,917
  • 7
  • 36
  • 44
341
votes
11 answers

Scrolling a flexbox with overflowing content

Here's the code I'm using to achieve the above layout: .header { height: 50px; } .body { position: absolute; top: 50px; right: 0; bottom: 0; left: 0; display: flex; } .sidebar { width: 140px; } .main { flex:…
Joseph Silber
  • 214,931
  • 59
  • 362
  • 292
332
votes
3 answers

How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?

I would like to have 2 separate Layouts in my application. Let's say one is for the Public section of the website and the other is for the Member side. For simplicity, let's say all the logic for each of these sites is wrapped neatly into 2 distinct…
Justin
  • 10,667
  • 15
  • 58
  • 79
320
votes
5 answers

How to make an app's background image repeat

I have set a background image in my app, but the background image is small and I want it to be repeated and fill in the whole screen. What should I do?
virsir
  • 15,159
  • 25
  • 75
  • 109
295
votes
4 answers

What's the difference between fill_parent and wrap_content?

In Android, when layout out widgets, what's the difference between fill_parent (match_parent in API Level 8 and higher) and wrap_content? Is there any documentation where you can point to? I'm interested in understanding it very well.
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
285
votes
11 answers

Set margins in a LinearLayout programmatically

I'm trying to use Java (not XML) to create a LinearLayout with buttons that fill the screen, and have margins. Here is code that works without margins: LinearLayout buttonsView = new…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
267
votes
5 answers

Auto-expanding layout with Qt-Designer

I'm using the Qt Designer. I want to create a QVBoxLayout which will automatically expand to fill the whole window. The layout of the QVBoxLayout remains fixed. How can I cause the QVBoxLayout to expand and fill the entire window through the…
Elazar Leibovich
  • 32,750
  • 33
  • 122
  • 169
266
votes
22 answers

How to change line color in EditText

I am creating an EditText in my layout xml file But I want to change color line in EditText from Holo to (for example) red. How that can be done?
Alex
  • 2,723
  • 2
  • 13
  • 6
245
votes
11 answers

How to add JTable in JPanel with null layout?

I want to add JTable into JPanel whose layout is null. JPanel contains other components. I have to add JTable at proper position.
Sagar
  • 2,475
  • 2
  • 15
  • 3
243
votes
6 answers

How to style a div to be a responsive square?

I want my div to adapt its height to always equal its width. The width is percental. When the parent's width decreases, the box should decrease by keeping its aspect ratio. How to do this is CSS?
danijar
  • 32,406
  • 45
  • 166
  • 297
240
votes
7 answers

What is "android.R.layout.simple_list_item_1"?

I've started learning Android development and am following a todolist example from a book: // Create the array list of to do items final ArrayList todoItems = new ArrayList(); // Create the array adapter to bind the array to the…
Zakaria
  • 14,892
  • 22
  • 84
  • 125
226
votes
9 answers

How to prevent line-break in a column of a table cell (not a single cell)?

How can I prevent automatic line breaks in a column of table (not a single cell)?
Steven
  • 24,410
  • 42
  • 108
  • 130