I\'m new to Android and I\'m working through a tutorial on programmatically creating a layout instead of doing it through the xml, I\'m sorta stuck can someone advise please. >
Simple way you can give dinamic width and height:-
LayoutParams layout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layout.setMargins(screenWidth / 5, screenHeight - cardHeight - 30, 0, 0); tvConftxt.setLayoutParams(layout);