本文整理匯總了Java中android.graphics.PixelFormat.TRANSLUCENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java PixelFormat.TRANSLUCENT屬性的具體用法?Java PixelFormat.TRANSLUCENT怎麽用?Java PixelFormat.TRANSLUCENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.graphics.PixelFormat
的用法示例。
在下文中一共展示了PixelFormat.TRANSLUCENT屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addView
@Override
public void addView(int width, int height, boolean isTouchable, @NonNull View view) {
int touchableFlag = isTouchable ? 0 : WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
width,
height,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | touchableFlag,
PixelFormat.TRANSLUCENT
);
params.gravity = Gravity.TOP | Gravity.LEFT;
params.x = 0;
params.y = 0;
mWindowManager.addView(view, params);
}
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:17,代碼來源:WindowViewController.java
示例2: onCreate
@Override
public void onCreate() {
wManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
mParams = new WindowManager.LayoutParams();
mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
mParams.format = PixelFormat.TRANSLUCENT;
mParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mParams.width = 490;
mParams.height = 160;
mParams.x = 0;
mParams.y = 0;
textView = (TextView) LayoutInflater.from(getApplicationContext()).inflate(R.layout.item_t, null);
textView.setText("WindowManager add View");
textView.setOnClickListener(this);
super.onCreate();
}
示例3: show
private void show(View view, int left, int top) {
if (view.getParent() != null || view.getWindowToken() != null) {
windowManager.removeView(view);
}
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.START | Gravity.TOP;
params.x = left;
params.y = top;
windowManager.addView(view, params);
}
示例4: setWindowParams
private void setWindowParams(int x, int y) {
// 建立item的縮略圖
windowParams = new WindowManager.LayoutParams();
windowParams.gravity = Gravity.BOTTOM | Gravity.RIGHT;// 這個必須加
// 得到preview左上角相對於屏幕的坐標
windowParams.x = x;
windowParams.y = y;
// 設置寬和高
windowParams.width = 80;
windowParams.height = 50;
windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
windowParams.format = PixelFormat.TRANSLUCENT;
windowParams.windowAnimations = 0;
}
示例5: WindowParams
public WindowParams(int width, int height, int grav, int xpos, int ypos) {
super(width, height,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
x = xpos;
y = ypos;
gravity = grav;
}
示例6: onCreate
@Override
public void onCreate() {
super.onCreate();
ctx = this;
wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
overlayedButton = new FloatingButton(ctx)
.setColor(MyColor.BLUE.getColor())
.setDrawable((BitmapDrawable) getResources().getDrawable(R.drawable.ic_list_white_48dp))
.setStroke(Utils.dip2px(ctx, 3) , MyColor.BLUE.getColorAccent())
.setPadding(Utils.dip2px(ctx, 13), Utils.dip2px(ctx, 10), Utils.dip2px(ctx, 13), Utils.dip2px(ctx, 10))
.show();
overlayedButton.setOnTouchListener(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(Utils.dip2px(ctx, 50), Utils.dip2px(ctx, 50), WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.TRANSLUCENT);
params.gravity = Gravity.LEFT | Gravity.TOP;
params.x = 0;
params.y = 0;
wm.addView(overlayedButton, params);
FloatingView = new View(this);
WindowManager.LayoutParams FloatingViewParams = new WindowManager.LayoutParams(Utils.dip2px(ctx, 50), Utils.dip2px(ctx, 50), WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.TRANSLUCENT);
FloatingViewParams.gravity = Gravity.LEFT | Gravity.TOP;
FloatingViewParams.x = 0;
FloatingViewParams.y = 0;
FloatingViewParams.width = 0;
FloatingViewParams.height = 0;
wm.addView(FloatingView, FloatingViewParams);
}
示例7: getOpacity
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
示例8: getOpacity
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
示例9: FloatingView
/**
* コンストラクタ
*
* @param context {@link android.content.Context}
*/
FloatingView(final Context context) {
super(context);
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mParams = new WindowManager.LayoutParams();
mMetrics = new DisplayMetrics();
mWindowManager.getDefaultDisplay().getMetrics(mMetrics);
mParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
mParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
mParams.type = WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
mParams.format = PixelFormat.TRANSLUCENT;
// 左下の座標を0とする
mParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
mAnimationHandler = new FloatingAnimationHandler(this);
mLongPressHandler = new LongPressHandler(this);
mMoveEdgeInterpolator = new OvershootInterpolator(MOVE_TO_EDGE_OVERSHOOT_TENSION);
mMoveDirection = FloatingViewManager.MOVE_DIRECTION_DEFAULT;
final Resources resources = context.getResources();
mIsTablet = (resources.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
mRotation = mWindowManager.getDefaultDisplay().getRotation();
mMoveLimitRect = new Rect();
mPositionLimitRect = new Rect();
// ステータスバーの高さを取得
mBaseStatusBarHeight = getSystemUiDimensionPixelSize(resources, "status_bar_height");
mStatusBarHeight = mBaseStatusBarHeight;
// get navigation bar height
final boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
final boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
if (hasMenuKey || hasBackKey) {
mBaseNavigationBarHeight = 0;
mBaseNavigationBarRotatedHeight = 0;
} else {
mBaseNavigationBarHeight = getSystemUiDimensionPixelSize(resources, "navigation_bar_height");
final String resName = mIsTablet ? "navigation_bar_height_landscape" : "navigation_bar_width";
mBaseNavigationBarRotatedHeight = getSystemUiDimensionPixelSize(resources, resName);
}
// 初回描畫処理用
getViewTreeObserver().addOnPreDrawListener(this);
}
示例10: getOpacity
@Override
public final int getOpacity() {
return PixelFormat.TRANSLUCENT;
}