本文整理汇总了Java中android.graphics.PixelFormat.RGBA_8888属性的典型用法代码示例。如果您正苦于以下问题:Java PixelFormat.RGBA_8888属性的具体用法?Java PixelFormat.RGBA_8888怎么用?Java PixelFormat.RGBA_8888使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.PixelFormat
的用法示例。
在下文中一共展示了PixelFormat.RGBA_8888属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLayoutParams
public WindowManager.LayoutParams createLayoutParams(int x,int y,int w,int h){
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= 23)
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
else
params.type = WindowManager.LayoutParams.TYPE_TOAST;
params.format = PixelFormat.RGBA_8888;
params.flags =WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH ;
params.gravity = Gravity.LEFT | Gravity.TOP;
params.width = w;
params.height = h;
params.x = x;
params.y = y;
return params;
}
示例2: addWindow
static void addWindow(Application app) {
activityLifecycleObservable = new ActivityLifecycleObservable();
activityTaskView = new ActivityTaskView(app);
activityTaskView.setObservable(activityLifecycleObservable);
qhandler = new QueueHandler();
WindowManager windowManager = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_PHONE;
params.format = PixelFormat.RGBA_8888;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.START | Gravity.TOP;
params.x = 0;
params.y = app.getResources().getDisplayMetrics().heightPixels;
windowManager.addView(activityTaskView, params);
app.registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
}
示例3: initView
public void initView(Context c) {
windowManager = (WindowManager) c.getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = getResources().getDisplayMetrics();
screenWidth = dm.widthPixels;
screenHeight = dm.heightPixels;
this.setImageResource(imgId);
windowManagerParams.type = WindowManager.LayoutParams.TYPE_PHONE;
windowManagerParams.format = PixelFormat.RGBA_8888; // 背景透明
windowManagerParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
// 调整悬浮窗口至左上角,便于调整坐标
windowManagerParams.gravity = Gravity.LEFT | Gravity.TOP;
// 以屏幕左上角为原点,设置x、y初始值
windowManagerParams.x = screenWidth;
windowManagerParams.y = screenHeight * 2 / 3;
// 设置悬浮窗口长宽数据
windowManagerParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
windowManagerParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
}
示例4: detectBestPixelFormat
private int detectBestPixelFormat() {
//Skip check if this is a new device as it will be RGBA_8888 by default.
if (isRGBA_8888ByDefault) {
return PixelFormat.RGBA_8888;
}
Context context = getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
//Get display pixel format
int displayFormat = display.getPixelFormat();
if ( PixelFormat.formatHasAlpha(displayFormat) ) {
return displayFormat;
} else {
return PixelFormat.RGB_565;//Fallback for those who don't support Alpha
}
}
示例5: showFloater
private void showFloater() {
if (isShown) {
return;
}
isShown = true;
TextView floater = new TextView(this);
floater.setBackgroundColor(Color.BLACK);
floater.setText(TAG);
floater.setTextColor(Color.WHITE);
floater.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, TAG, Toast.LENGTH_LONG).show();
}
});
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams lph = new WindowManager.LayoutParams();
lph.type = WindowManager.LayoutParams.TYPE_TOAST;
lph.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
lph.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
lph.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
lph.width = WindowManager.LayoutParams.MATCH_PARENT;
lph.height = 100;
lph.format = PixelFormat.RGBA_8888;
lph.gravity = Gravity.TOP;
wm.addView(floater, lph);
}
示例6: show
private void show() {
mLayoutParams = new WindowManager.LayoutParams();
mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
mLayoutParams.format = PixelFormat.RGBA_8888;
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mLayoutParams.flags = mLayoutParams.flags | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
mLayoutParams.flags = mLayoutParams.flags | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
mLayoutParams.gravity = Gravity.START | Gravity.TOP;
mLayoutParams.x = 0;
mLayoutParams.y = 0;
DisplayMetrics dm = new DisplayMetrics();
WindowManager manager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
manager.getDefaultDisplay().getMetrics(dm);
mLayoutParams.width = dm.widthPixels;
mLayoutParams.height = dm.heightPixels;
layout = new FrameLayout(getContext());
mWindowManager.addView(layout, mLayoutParams);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(layoutWidth, layoutHeight);
setX(mCreateX);
setY(mCreateY);
layout.addView(this, params);
mTargetView.setVisibility(INVISIBLE);
}
示例7: showWindow
private void showWindow() {
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
// layoutParams.type = WindowManager.LayoutParams.TYPE_TOAST;
layoutParams.type = TYPE_SYSTEM_OVERLAY;
layoutParams.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCHABLE | FLAG_NOT_TOUCH_MODAL;
layoutParams.format = PixelFormat.RGBA_8888;
try {
windowManagermanager.addView(marquee, layoutParams);
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: initWindow
private void initWindow() {
mWindowManager = WindowUtil.getWindowManager(getContext().getApplicationContext());
mParams = new WindowManager.LayoutParams();
mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; // 设置window type
// 设置图片格式,效果为背景透明
mParams.format = PixelFormat.RGBA_8888;
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mParams.gravity = Gravity.START | Gravity.TOP; // 调整悬浮窗口至右下角
// 设置悬浮窗口长宽数据
int width = WindowUtil.dp2px(getContext(), 250);
mParams.width = width;
mParams.height = width * 9 / 16;
mParams.x = floatX;
mParams.y = floatY;
}
示例9: initWindowParams
public static void initWindowParams() {
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.x = 0;
params.y = 0;
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.LEFT | Gravity.TOP;
params.type = TYPE_SYSTEM_ALERT; //TYPE_PHONE
params.format = PixelFormat.RGBA_8888;
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
// | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
LAYOUT_PARAMS = params;
}
示例10: getDefaultSystemWindowParams
public static WindowManager.LayoutParams getDefaultSystemWindowParams() {
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
params.format = PixelFormat.RGBA_8888;
params.gravity = Gravity.TOP | Gravity.LEFT;
return params;
}
示例11: getDefaultSystemWindowParams
public static WindowManager.LayoutParams getDefaultSystemWindowParams(Context context) {
int size = context.getResources().getDimensionPixelSize(com.theLoneWarrior.floating.R.dimen.action_button_size);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
size,
size,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, // z-ordering
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
params.format = PixelFormat.RGBA_8888;
params.gravity = Gravity.TOP | Gravity.LEFT;
return params;
}
示例12: showWindow
public void showWindow(final Context context) {
final WindowManager mWindow = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams param = new WindowManager.LayoutParams();
if (view == null) {
LayoutInflater inflater = (LayoutInflater) context.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.layout_ball, null);
ImageView button = (ImageView) view.findViewById(R.id.img_ball);
int screenWidth = mWindow.getDefaultDisplay().getWidth();
int screenHeight = mWindow.getDefaultDisplay().getHeight();
param.x = screenWidth;
param.y = screenHeight / 2;
param.width = WindowManager.LayoutParams.WRAP_CONTENT;
param.height = WindowManager.LayoutParams.WRAP_CONTENT;
param.gravity = Gravity.LEFT | Gravity.TOP;
param.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;//TYPE_SYSTEM_ALERT TYPE_TOAST
param.format = PixelFormat.RGBA_8888;
param.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;//设备常亮
view.setLayoutParams(param);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (view != null) {
addView();
// mWindow.removeView(view);
// view = null;
Log.e("xiaoxin", "wimdow: ");
//mWindowManagerUtil.addView();
// context.startService(
// new Intent(context, AutoSendMsgService.class)
// .putExtra(AutoSendMsgService.COMMAND, AutoSendMsgService.COMMAND_OPEN)
// );
}
}
});
mWindow.addView(view, param);
}
}
示例13: initWindow
private void initWindow(){
if(mDragView == null){
mDragView = View.inflate(getContext(), R.layout.textview_tag, null);
ImageView cross = (ImageView) mDragView.findViewById(R.id.tag_close);
cross.setVisibility(INVISIBLE);
TextView tv = (TextView) mDragView.findViewById(R.id.tag_textview);
tv.setText(((TextView)mOldView.findViewById(R.id.tag_textview)).getText());
}
if(mWindowLayoutParams == null){
mWindowLayoutParams = new WindowManager.LayoutParams();
mWindowLayoutParams.width = mOldView.getWidth();
mWindowLayoutParams.height = mOldView.getHeight();
//这里的坐标取值还是有点问题
//暂时没有发现问题所在
Rect rect = new Rect();
mOldView.getGlobalVisibleRect(rect);
mWindowLayoutParams.x = rect.left;
mWindowLayoutParams.y = rect.top;
/*int[] co = new int[2];
mOldView.getLocationInWindow(co);
mWindowLayoutParams.x = co[0];
mWindowLayoutParams.y = co[1];*/
/*mWindowLayoutParams.x = mOldView.getLeft() + this.getLeft();
mWindowLayoutParams.y = mOldView.getTop() + this.getTop();*/
//系统Window无需Activity的Context
mWindowLayoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
mWindowLayoutParams.format = PixelFormat.RGBA_8888;
mWindowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
//window外的touch事件交给下层window处理,window内的自身处理。
//本身不聚焦,将touch事件交给下层window处理。
mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
}
//该window中的View开始绘制,并通知wms保存window状态
mWindowManager.addView(mDragView, mWindowLayoutParams);
mMode = MODE_DRAG;
}