I'm trying to add 9 button to my activity i would like to add button like these:
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_columnSpan="1"
android:layout_rowSpan="1"
android:text="@string/button1"
android:layout_margin="5dp"/>
currently I'm using this
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = this;
GridLayout gridBoutons = findViewById(R.id.layout_gridBoutons);
for(int i = 0; i != 9;i++){
Bouton bouton = new Bouton(context);
bouton.setText("");
GridLayout.LayoutParams param = new GridLayout.LayoutParams();
param.height = GridLayout.LayoutParams.WRAP_CONTENT;
param.width = GridLayout.LayoutParams.WRAP_CONTENT;
bouton.setLayoutParams(param);
gridBoutons.addView(bouton);
}
}
I do not know how to have the column weight row weight column span and the row span