@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate (savedInstanceState); TextView tv = new TextView(this); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); // Set the position where the ad appears (floating at the top) params.topMargin = 0; params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; tv.setText("I wipe...dynamic layout"); addContentView(tv, params); // setContentView(tv); }
If it is service, it can be used
getWindow().addContentView(l1, params);