Questions tagged [padding]

Extra space inserted into memory structures to achieve address alignment -or- extra space between the frame and the content of an HTML element -or- extra spaces or zeros when printing out values using formatting print commands like, in C, the printf*-family of functions.

Padding in memory structures is the insertion of additional bytes of unused space to make the internal fields of a structure align to desirable address boundaries.

Padding in HTML layout is extra space inserted between the content of the element and its border or frame. Padding is space added to the interior of the element; margin is space around the exterior of the element.

In arrays, padding is addition of extra 0's (zeros) in one or more dimension of the array in a symmetric, circular or replicating manner. This is important for signal and image processing, in the context of and convolution.

3939 questions
55
votes
14 answers

Center CheckBox drawable within itself

I have a CheckBox that I want centered within its own boundaries, not pushed to the side. Probably easier demonstrated than explained: Note that it isn't centered. Currently defined as:
davidcesarino
  • 16,160
  • 16
  • 68
  • 109
51
votes
8 answers

How to add padding around a WebView

My layout file defines a WebView, underneath which there are some fixed height buttons.
Dan J
  • 25,433
  • 17
  • 100
  • 173
50
votes
1 answer

Android View setPadding() vs setPaddingRelative()

Based on the Android document which doesn't give much explanation, what's the difference between setPadding() vs setPaddingRelative()?
jerrytouille
  • 1,238
  • 1
  • 13
  • 28
49
votes
14 answers

Center text in div?

I have a div 30px high and 500px wide. This div can contain two lines of text one under the other, and is styled (padded) accordingly. But sometimes it only contains one line, and I want it to be centered. Is this possible?
Rifki
  • 893
  • 1
  • 11
  • 22
49
votes
10 answers

Padding a swift String for printing

I'm trying to print a list of Strings all padded to the same width. In C, I would use something like printf("%40s", cstr), where cstr is a C string. In Swift, the best I could come up is this: line += String(format:…
Droopycom
  • 1,831
  • 1
  • 17
  • 20
49
votes
6 answers

Using margin / padding to space from the rest of the

Ive got a block of text, and i want to write the authors name and date bellow it in small italics, so i put it in a block and styled it, but i want to space the name out a little bit so i applided margin (also tried padding) to the block but…
sam
  • 9,486
  • 36
  • 109
  • 160
48
votes
5 answers

Why is the padding not working on my label elements?

I have some markup here:
dqhendricks
  • 19,030
  • 11
  • 50
  • 83
48
votes
5 answers

Add bigger margin to EditText in Android AlertDialog

I have an EditText inside an AlertDialog. It looks like this. See where it says tddjdjck and how it is indented quite a lot. That is what I want (I used setPadding with left and right set to 50), but I also want the blue line under it to be…
b85411
  • 9,420
  • 15
  • 65
  • 119
47
votes
6 answers

How can we change the width/padding of a Flutter DropdownMenuItem in a Dropdown?

In Flutter, I can build a Dropdown with DropdownMenuItems, like this: The DropdownMenuItems I add are always wider than the dropdown itself: How do you adjust the width of the DropdownMenuItem, or remove the extra horizontal padding? My…
Mary
  • 18,347
  • 23
  • 59
  • 76
47
votes
7 answers

Android: set just one padding of textview programmatically

I want to set the top padding of a textview programmatically. I know you can do this with the method setPadding(). But the problem is that this method requires 4 parameters: left, top, right, bottom. I don't want to change the left, right and…
Xander
  • 5,487
  • 14
  • 49
  • 77
44
votes
8 answers

Is struct packing deterministic?

For example, say I have two equivalent structs a and b in different projects: typedef struct _a { int a; double b; char c; } a; typedef struct _b { int d; double e; char f; } b; Assuming I haven't used any directives like…
Govind Parmar
  • 20,656
  • 7
  • 53
  • 85
44
votes
6 answers

Get rid of spaces between spans

I'm trying to emulate a tab bar with HTML. I'd like the width of each tab to be set according to the text length (that is, no fixed width) and to word wrap in case it exceeds the screen width. I've almost achieved it:
opensas
  • 60,462
  • 79
  • 252
  • 386
42
votes
12 answers

Remove unwanted White Space in WebView Android

I have started developing an App using WebView. Actually I am loading an Image with Webview (I like to use the built-in zoom controls of the class). I can successfully load the Image but I can see some irritating white spaces. I can't find the way…
Manimaran
  • 421
  • 1
  • 4
  • 4
42
votes
7 answers

CSS: Is it correct that text content of a div overflows into the padding?

I expected that the padding inside a div would remain clear of any text. But given the following html/css, the content-text spills out into the padding;
helloworld
.foo { float: left; overflow: hidden; background: red; …
Nigel Alderton
  • 2,265
  • 2
  • 24
  • 55
41
votes
5 answers

Padding in structures in C

This is an interview question. Till now, I used to think such questions were purely compiler dependent and shouldn't worry me, but now, I am rather curious about it. Suppose you are given two structures as: struct A { int* a; char b; } …
letsc
  • 2,075
  • 5
  • 24
  • 43