Birinci için tost Dinamik konumunu ayarlayın i onay kutusunu yanında tost görüntülemek istediğiniz sorun şu ki Yani Şimdi tam koda View Tüm bunların
@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;
}
}
değil, ben setGravity()
ile çalışan, ama sadece o çalıştı Çalışmıyor ve uzun süredir çalışıyor ve çalışıyor, ancak ilerleme yok
Onay kutusunun yanında nasıl tost görüntülenir.
Bu cevap http aldığım
location[1]
gelen y koordinatları olsun: // stackoverflow .com/a/21026866/630833, Toast'ın boyutunu göz önünde bulundurarak, bana yardımcı oldu. – jayeffkay