I am trying to create Alertdialog and add 3 togglebuttons with images to it programmatically.
I tried starting with one togglebutton and for some reason the alert dialog is really small (just around the image) and the button itself looks weird(image bigger than button)..
Here is my code, do spot anything wrong?
LinearLayout ll = new LinearLayout(mActivity);
ll.setOrientation(LinearLayout.VERTICAL);
ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
ToggleButton tb;
for(int i=0;i<cards.size();i++){
Card card = cards.get(i);
tb = new ToggleButton(mActivity);
tb.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
tb.setButtonDrawable(card.getDrawable(mActivity));
ll.addView(tb);
}
AlertDialog.Builder builder;
AlertDialog alertDialog;
builder = new AlertDialog.Builder(mActivity);
builder.setView(ll);
alertDialog = builder.create();
alertDialog.show();