I am using a Button
created using following code
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
Button btn = new Button(this);
btn.setOnClickListener(newtodobtn);
btn.setText("New Todo");
btn.setBackgroundDrawable(new Button(this).getBackground());
ll.addView(btn);
I have an image in path @drawable/new_todo_image
to set as background for the button. How to set it to the Button
programmatically?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…