Java Code Examples for android.view.WindowManager.LayoutParams#WRAP_CONTENT
The following examples show how to use
android.view.WindowManager.LayoutParams#WRAP_CONTENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PopupDialog.java From Noyze with Apache License 2.0 | 6 votes |
private static WindowManager.LayoutParams getWindowLayoutParams() { int flags = (LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | LayoutParams.FLAG_DIM_BEHIND ); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) flags |= LayoutParams.FLAG_HARDWARE_ACCELERATED; if (!BuildConfig.DEBUG) flags |= LayoutParams.FLAG_SECURE; LayoutParams WPARAMS = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, LayoutParams.TYPE_SYSTEM_ALERT, flags, PixelFormat.TRANSLUCENT); final int windowAnimations = getInternalStyle("Animation_Dialog"); if (windowAnimations > 0) WPARAMS.windowAnimations = windowAnimations; WPARAMS.dimAmount = 0.6f; WPARAMS.packageName = PopupDialog.class.getPackage().getName(); WPARAMS.setTitle(TAG); WPARAMS.gravity = Gravity.CENTER; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE; return WPARAMS; }
Example 2
Source File: TestActivity.java From android-art-res with Apache License 2.0 | 6 votes |
public void onButtonClick(View v) { if (v == mCreateWindowButton) { mFloatingButton = new Button(this); mFloatingButton.setText("click me"); mLayoutParams = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0, PixelFormat.TRANSPARENT); mLayoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_SHOW_WHEN_LOCKED; mLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR; mLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; mLayoutParams.x = 100; mLayoutParams.y = 300; mFloatingButton.setOnTouchListener(this); mWindowManager.addView(mFloatingButton, mLayoutParams); } }
Example 3
Source File: PopupDialog.java From Noyze with Apache License 2.0 | 6 votes |
private static WindowManager.LayoutParams getWindowLayoutParams() { int flags = (LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | LayoutParams.FLAG_DIM_BEHIND ); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) flags |= LayoutParams.FLAG_HARDWARE_ACCELERATED; if (!BuildConfig.DEBUG) flags |= LayoutParams.FLAG_SECURE; LayoutParams WPARAMS = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, LayoutParams.TYPE_SYSTEM_ALERT, flags, PixelFormat.TRANSLUCENT); final int windowAnimations = getInternalStyle("Animation_Dialog"); if (windowAnimations > 0) WPARAMS.windowAnimations = windowAnimations; WPARAMS.dimAmount = 0.6f; WPARAMS.packageName = PopupDialog.class.getPackage().getName(); WPARAMS.setTitle(TAG); WPARAMS.gravity = Gravity.CENTER; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE; return WPARAMS; }
Example 4
Source File: Takt.java From styT with Apache License 2.0 | 5 votes |
private Program prepare(Application application) { metronome = new Metronome(); params = new LayoutParams(); params.width = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT; // if (isOverlayApiDeprecated()) { // params.type = LayoutParams.TYPE_APPLICATION_OVERLAY; // } else { params.type = LayoutParams.TYPE_TOAST; //} params.flags = LayoutParams.FLAG_KEEP_SCREEN_ON | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL; params.format = PixelFormat.TRANSLUCENT; params.gravity = Seat.BOTTOM_RIGHT.getGravity(); params.x = 10; app = application; wm = WindowManager.class.cast(application.getSystemService(Context.WINDOW_SERVICE)); LayoutInflater inflater = LayoutInflater.from(app); stageView = inflater.inflate(R.layout.stage, new RelativeLayout(app)); fpsText = stageView.findViewById(R.id.takt_fps); listener(new Audience() { @Override public void heartbeat(double fps) { if (fpsText != null) { fpsText.setText(decimal.format(fps)); } } }); return this; }
Example 5
Source File: Takt.java From stynico with MIT License | 5 votes |
private Program prepare(Application application) { metronome = new Metronome(); params = new LayoutParams(); params.width = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT; // if (isOverlayApiDeprecated()) { // params.type = LayoutParams.TYPE_APPLICATION_OVERLAY; // } else { params.type = LayoutParams.TYPE_TOAST; //} params.flags = LayoutParams.FLAG_KEEP_SCREEN_ON | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL; params.format = PixelFormat.TRANSLUCENT; params.gravity = Seat.BOTTOM_RIGHT.getGravity(); params.x = 10; app = application; wm = WindowManager.class.cast(application.getSystemService(Context.WINDOW_SERVICE)); LayoutInflater inflater = LayoutInflater.from(app); stageView = inflater.inflate(R.layout.stage, new RelativeLayout(app)); fpsText = (TextView) stageView.findViewById(R.id.takt_fps); listener(new Audience() { @Override public void heartbeat(double fps) { if (fpsText != null) { fpsText.setText(decimal.format(fps)); } } }); return this; }
Example 6
Source File: Takt.java From Takt with Apache License 2.0 | 5 votes |
private Program prepare(Application application) { metronome = new Metronome(); params = new LayoutParams(); params.width = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT; application.registerActivityLifecycleCallbacks(new LifecycleListener(this)); if (isOverlayApiDeprecated()) { params.type = LayoutParams.TYPE_APPLICATION_OVERLAY; } else { params.type = LayoutParams.TYPE_TOAST; } params.flags = LayoutParams.FLAG_KEEP_SCREEN_ON | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_NOT_TOUCHABLE; params.format = PixelFormat.TRANSLUCENT; params.gravity = Seat.BOTTOM_RIGHT.getGravity(); params.x = 10; app = application; wm = WindowManager.class.cast(application.getSystemService(Context.WINDOW_SERVICE)); LayoutInflater inflater = LayoutInflater.from(app); stageView = inflater.inflate(R.layout.stage, new RelativeLayout(app)); fpsText = stageView.findViewById(R.id.takt_fps); listener(new Audience() { @Override public void heartbeat(double fps) { if (fpsText != null) { fpsText.setText(decimal.format(fps)); } } }); return this; }
Example 7
Source File: IndexActivity.java From dttv-android with GNU General Public License v3.0 | 5 votes |
public void open_pager(View v) { /*Intent intent = new Intent(); intent.setClass(this, MainActivity.class); startActivity(intent);*/ /*PopWindowCompnent compnent = new PopWindowCompnent(this,this); compnent.show(v, true);*/ View view = LayoutInflater.from(this).inflate(R.layout.effect_popwindow, null); ListView listView = (ListView) view.findViewById(R.id.pop_listview); TextView textView = (TextView) view.findViewById(R.id.pop_window_txt); float textSize = textView.getTextSize(); Log.i("textSize", "----textSize is:" + textSize); textView.setTextSize(textSize < 18 ? 18 : 21); PopupWindow popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); //popupWindow.setBackgroundDrawable(R.drawable.) ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Constant.gEqulizerPresets); popupWindow.setAnimationStyle(R.style.pop_win_style); ColorDrawable dw = new ColorDrawable(0xb0000000); popupWindow.setBackgroundDrawable(dw); listView.setAdapter(adapter); //popupWindow.showAsDropDown(v); int location[] = new int[2]; v.getLocationOnScreen(location); int _x = location[0]; int _y = location[1] - popupWindow.getHeight(); popupWindow.showAtLocation(v, Gravity.NO_GRAVITY, _x, _y); //popupWindow.showAsDropDown(v, _x, _y); }
Example 8
Source File: PopWindowCompnent.java From dttv-android with GNU General Public License v3.0 | 5 votes |
@Override public void initialize() { // TODO Auto-generated method stub super.initialize(); View view = LayoutInflater.from(mActivity).inflate(R.layout.effect_popwindow, null); mListView = (ListView) view.findViewById(R.id.pop_listview); fillData(); effectWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); effectWindow.setAnimationStyle(R.style.pop_win_style); ColorDrawable dw = new ColorDrawable(0xb0ffffff); effectWindow.setBackgroundDrawable(dw); mListView.setOnItemClickListener(new ItemClickListener()); }
Example 9
Source File: ManageListActivity.java From opentasks with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); mTaskListUri = intent.getData(); mAction = intent.getAction(); mAccount = intent.getParcelableExtra(EXTRA_ACCOUNT); if (mTaskListUri == null || mAction == null || mAccount == null) { setResult(Activity.RESULT_CANCELED); finish(); return; } setContentView(R.layout.activity_manage_task_list); LayoutParams params = getWindow().getAttributes(); params.height = LayoutParams.WRAP_CONTENT; params.width = LayoutParams.WRAP_CONTENT; getWindow().setAttributes(params); findViewById(R.id.color_setting).setOnClickListener(this); findViewById(R.id.name_setting).setOnClickListener(this); mNameView = (TextView) findViewById(R.id.list_name); mColorView = findViewById(R.id.list_color); if (Intent.ACTION_EDIT.equals(mAction)) { initEditing(savedInstanceState); return; } if (Intent.ACTION_INSERT.equals(mAction)) { initInsert(savedInstanceState); } }