I am new in android development. I want to set margin & padding in Xml,not in dp or px but in percentage. Is there any way to do this?
it is not possible, though You better do it by taking width and height of screen like below in your java code, and
Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight();
then calculate your margin from screen size, and set it by
setmargin(int x) //method of view/layout.
this way you can set margin depending on the screen size not fixed for all screen, and basically it is like setting in percentage but from Java code.