- Context context = getApplicationContext();
- Toast customizedToast =Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG);
- customizedToast.setGravity(Gravity.TOP, 0, 0);
- LinearLayout mLayout = new LinearLayout(context);
- mLayout.setOrientation(LinearLayout.VERTICAL);
- TextView mTV = new TextView(context);
- CustomView cv = new CustomView(context);
- mTV.setText(text);
- int height = LinearLayout.LayoutParams.FILL_PARENT;
- int width = LinearLayout.LayoutParams.WRAP_CONTENT;
- mLayout.addView(cv, new LinearLayout.LayoutParams(height, width));
- mLayout.addView(mTV, new LinearLayout.LayoutParams(height, width));
- customizedToast.setView(mLayout);
- customizedToast.show();
Thursday, 10 November 2011
Customize toast
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment