List of usage examples for android.view WindowManager.LayoutParams WindowManager.LayoutParams
WindowManager.LayoutParams
From source file:com.perm.DoomPlay.LyricsDialog.java
@Override public void onResume() { super.onResume(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(getDialog().getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; getDialog().getWindow().setAttributes(lp); if (isFirstResume) { getLyrics();// w w w. ja v a2 s . c o m isFirstResume = false; } else { textView.setText(lyrics); } }
From source file:og.android.tether.MainActivity.java
private void openAdBar() { LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View ad_view = li.inflate(R.layout.ad_view, null); ad_view.setBackgroundColor(Color.TRANSPARENT); final WindowManager wm = getWindowManager(); WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(); wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.gravity = Gravity.BOTTOM;//from w w w. j av a 2 s . c om wmParams.y = 100; wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; wmParams.format = PixelFormat.TRANSLUCENT; wm.addView(ad_view, wmParams); View ad_open = ad_view.findViewById(R.id.ad_open); View ad_close = ad_view.findViewById(R.id.ad_close); OnClickListener adListener = new OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.ad_open: Log.i(MSG_TAG, "ad_open"); Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.addCategory(Intent.CATEGORY_BROWSABLE); i.setData(Uri.parse( "market://details?id=com.opengarden.radiofreenet&referrer=utm_source%3Dog.android.tether%26utm_medium%3Dandroid%26utm_campaign%3Dbanner%26utm_content%3Dinstall")); try { startActivity(i); } catch (android.content.ActivityNotFoundException e) { Log.e(MSG_TAG, "", e); MainActivity.this.application.displayToastMessage(e.toString()); } break; case R.id.ad_close: Log.i(MSG_TAG, "ad_close"); wm.removeView(ad_view); break; default: Log.i(MSG_TAG, "default"); break; } } }; ad_open.setOnClickListener(adListener); ad_close.setOnClickListener(adListener); }