For this we just need a class and we will programmatically create the Layouts. And after this we will add Buttons in each layout. package com.AndroidDevelopmentGuru.progmatic; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Gravity; import android.widget.Button; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; public class progmmatic extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //creating a Linear Layout LinearLayout parent_layout = new LinearLayout(this);
Learn Android tutorial Android Basics in Kotlin, Advanced Kotlin, Kotlin Fundamentals, Android Developer Fundamentals (Java)