view.setPadding(0,padding,0,0);
This will set the top padding to padding
-pixels.
If you want to set it in dp
instead, you can do a conversion:
float scale = getResources().getDisplayMetrics().density;
int dpAsPixels = (int) (sizeInDp*scale + 0.5f);
More Related Contents:
- How to start a Service when .apk is Installed for the first time
- Changing position of the Dialog on screen android
- How to show one layout on top of the other programmatically in my case?
- How to access resource with dynamic name in my case?
- How to make bitmap invisible ontouch in android? [closed]
- What does android:layout_weight mean?
- Android How to adjust layout in Full Screen Mode when softkeyboard is visible
- Write a file in external storage in Android
- How to dismiss the dialog with click on outside of the dialog?
- Android Smudged layout
- UnsupportedOperationException: Can’t convert to dimension: type=0x1
- How did Google manage to do this? Slide ActionBar in Android application
- Pop up window over Android native incoming call screen like true caller Android app
- How to set android layout to support all screen sizes?
- Android Image View Pinch Zooming [duplicate]
- Android Custom Shape Button
- How to save the image to SD card on button Click android [closed]
- Dynamically creating Buttons and setting onClickListener
- Running google map application on Android Emulator
- Memory leaks with custom font for set custom font
- How to change default images of CheckBox
- Rotate View Hierarchy 90 degrees
- Custom format edit text input android to accept credit card number
- Setting Action Bar title and subtitle
- How to add views dynamically to a RelativeLayout already declared in the xml layout?
- Creating an android smart app banner
- Changing size of seekbar thumb
- Disable multi finger touch in my app [duplicate]
- Placing ViewPager as a row in ListView
- Android WebView Scrollable