soniamca17
Lurker
I am developing one android app. I want create button at run time in that app using java code. I am able to create the button with below code-
btn = new Button(this);
btn.setText("Hello Button");
RelativeLayout.LayoutParams paramsd = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
paramsd.height = 60;
paramsd.width = 60;
btn.setLayoutParams(paramsd);
addContentView(btn,paramsd);
By above code button is successfully created at the top-left corner. I am trying to align in the bottom corner using-
paramsd.addRule(RelativeLayout.ALIGN_BOTTOM);
But it is not getting aligned Please help me to get this sorted..........
btn = new Button(this);
btn.setText("Hello Button");
RelativeLayout.LayoutParams paramsd = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
paramsd.height = 60;
paramsd.width = 60;
btn.setLayoutParams(paramsd);
addContentView(btn,paramsd);
By above code button is successfully created at the top-left corner. I am trying to align in the bottom corner using-
paramsd.addRule(RelativeLayout.ALIGN_BOTTOM);
But it is not getting aligned Please help me to get this sorted..........