I have 7 to 8 buttons in my application.
Like this.
How can I do this? I used:
LinearLayout ll = (LinearLayout)findViewById(R.id.searchdialog_layout);
ll.setOrientation(0);
Button btn = new Button(context);
btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble_layout));
btn.setPadding(4,0, 4, 0);
btn.setTextSize开发者_JAVA百科(14);
btn.setTextColor(Color.BLACK);
btn.setText("bubble" + " x");
ll.addView(btn) ;
But it didn't work.
Can anyone help?
Button btnabout = (Button) findViewById(R.id.btnAbout);
btnabout.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View V)
{
//do something
}//end onClick
});//end button
traditional way of creating a button
精彩评论