Programing
Android Inflater(사용자 레이아웃)
W.A
2010. 8. 16. 14:36
Inflater
AlertDialog.Builder builder;
AlertDialog alertDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LayoutInflater inflater = (LayoutInflater)this
.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custum_dialog,
(ViewGroup)findViewById(R.id.layout_root));
TextView text = (TextView)layout.findViewById(R.id.text);
text.setAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
text.setText("hello, this is a custom dialog!");
ImageView image = (ImageView)layout.findViewById(R.id.image);
image.setImageResource(R.drawable.icon);
builder = new AlertDialog.Builder(this);
builder.setView(layout);
alertDialog = builder.create();
alertDialog.show();
}