本文整理匯總了Java中android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT屬性的典型用法代碼示例。如果您正苦於以下問題:Java LayoutParams.TYPE_SYSTEM_ALERT屬性的具體用法?Java LayoutParams.TYPE_SYSTEM_ALERT怎麽用?Java LayoutParams.TYPE_SYSTEM_ALERT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.view.WindowManager.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.TYPE_SYSTEM_ALERT屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addViewToWindow
@SuppressWarnings("deprecation")
private void addViewToWindow(View view) {
final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.type = LayoutParams.TYPE_SYSTEM_ALERT;
final WindowManager windowManager =
(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Preconditions.checkNotNull(windowManager).addView(view, layoutParams);
}
示例2: init
public static void init(Context context) {
sWindowManager = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
sLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
VERSION.SDK_INT >= VERSION_CODES.M ? LayoutParams.TYPE_SYSTEM_ALERT : LayoutParams.TYPE_TOAST,
0x18, PixelFormat.TRANSLUCENT);
sLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
sView = LayoutInflater.from(context.getApplicationContext()).inflate(R.layout.view_tracker_window, null);
}