Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid value formats for android:padding?

Tags:

android

When writing xml files, I know following is working:

android:padding="20px"

Are there other valid value formats available for padding? e.g.

android:padding="10px 20px 10px 20px"
like image 411
Freewind Avatar asked Sep 11 '12 13:09

Freewind


People also ask

What is padding in Android layout?

Padding can be used to offset the content of the view by a specific number of pixels. For instance, a left padding of 2 will push the view's content by 2 pixels to the right of the left edge.

What is padding start in Android Studio?

Padding is used to add a blank space between a view and its contents.

What is stroke in Android XML?

This is used to control the behavior of miter joins when the joins angle is sharp. This value must be >= 0.

What is a TextView in Android?

TextView is the user interface which displays the text message on the screen to the user. It is based on the layout size, style, and color, etc. TextView is used to set and display the text according to our specifications.


1 Answers

You can use android:paddingLeft , android:paddingRight , android:paddingTop , android:paddingBottom separately.

Alternatively, since API v17, to properly support bidirectional text (LTR & RTL), change Left to Start and Right to End in all occurances. E.g. android:paddingLeft becomes android:paddingStart.

You can set padding using coding . setPadding (int left, int top, int right, int bottom)

like image 68
Chirag Avatar answered Oct 10 '22 13:10

Chirag