本文整理汇总了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;
}