Is it possible to add drawables to the positive, negative and neutral buttons of an AlertDialog? If yes, then how?
1.first create a new layout file to store the imagebuttons:new_layout.xml;
2.add the code below to where you want the dialogue to show:
final AlertDialog alertDialog = new AlertDialog.Builder(TalkerActivity.this).create();
alertDialog.show();
Window win = alertDialog.getWindow();
win.setContentView(R.layout.new_layout);
//Game
ImageButton game_btn = (ImageButton)win.findViewById(R.id.game);
game_btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
//Browser
ImageButton browser_btn = (ImageButton)win.findViewById(R.id.browser);
browser_btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
//Email
ImageButton email_btn = (ImageButton)win.findViewById(R.id.email);
email_btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
link:http://blog.csdn.net/willproud/article/details/9191971