2010.11.22 15:24
    

 일반적인 Toast에 질릴 때, 다음과 같이 Custom Toast를 만들어 보자.

Toast mToast = new Toast (this);
...
    //view layout inflate
    View view = View.inflate(this, R.layout.toast, null); 
TextView text = (TextView)view.findViewById(R.id.text_toast);
ImageView image = (ImageView)view.findViewById(R.id.toast_image);
text.setText(getText(R.string.setting_toast).toString()+Integer.toString(size));
image.setBackgroundResource(R.drawable.toast_list);
//toast에 적용
                mToast.setView(view);
mToast.setGravity(Gravity.CENTER, 0, 220);
mToast.setDuration(Toast.LENGTH_SHORT);
mToast.show();
            ...
신고
Posted by 구름같은사나이

티스토리 툴바