Back to Browse

Android Studio - Programmatically set width height and margins for TextView and other views

11.1K views
May 18, 2018
5:17

You could become better at Android Studio with these recommended books :- (Program code and links below) Learning Java by Building Android Games - https://amzn.to/2Bs3W5u Java - A Beginner’s Guide - https://amzn.to/2A2yDyg Beginning Android Programming with Android Studio - https://amzn.to/2SW7F2h Android App Development for Dummies - https://amzn.to/2BpYksk Code:- LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(int width, int height); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(int width, int height, float weight); //For margins in DP lp.setMargins(int left, int top, int right, int bottom); YourViewObject.setLayoutParams(lp);

Download

0 formats

No download links available.

Android Studio - Programmatically set width height and margins for TextView and other views | NatokHD