First of all this is not complete code
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
Toast toast=Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0);
View view=toast.getView();
switch(buttonView.getId())
{
case R.id.chkRed: if(chkRed.isChecked())
{
chkGreen.setChecked(false);
chkBlue.setChecked(false);
chkYellow.setChecked(false);
toast.setText("You Selected Red");
toast.setGravity(Gravity.NO_GRAVITY,buttonView.getRight(), chkRed.getTop());
//top does not align
//it align perfectly to right of checkbox
view.setBackgroundColor(Color.RED);
}
break;
}
}
So Now, the problem is, i want to display toast beside checkbox, i tried working with setGravity()
,but it just does not workup and have been hit and trying for long time, but with no progress
How to display toast beside the checkbox.