I create some buttons in my java code. The probleme is the text that i create for this button is always center, do you know how to change is position. I've search and no found because i create it in the java code, not in the xml
Button moncasier = new Button (this);
moncasier.setText("casier numéro :"+i);
moncasier.setTextSize(30);
moncasier.setBackground(getResources().getDrawable(R.drawable.img_casier));
layoutDesCasiers = (LinearLayout)findViewById(R.id.affichecasier);
layoutDesCasiers.addView(moncasier);
Thanks for the time you spend to me and sorry for my bad english
moncasier.setGravity(Gravity.BOTTOM);
您可以使用重力进行文本对齐,底部是上面的示例。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.