當前位置: 首頁>>代碼示例>>Java>>正文


Java PixelFormat.RGBA_8888屬性代碼示例

本文整理匯總了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;

}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:20,代碼來源:FloatView.java

示例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);
}
 
開發者ID:rome753,項目名稱:ActivityTaskView,代碼行數:21,代碼來源:ActivityTask.java

示例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;
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:20,代碼來源:FloatView.java

示例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
        }
    }
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:20,代碼來源:CustomMapView.java

示例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);
    }
 
開發者ID:zhangjianli,項目名稱:StallBuster,代碼行數:34,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:28,代碼來源:DragView.java

示例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();
        }
    }
 
開發者ID:android-notes,項目名稱:sao,代碼行數:13,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:dueeeke,項目名稱:dkplayer,代碼行數:15,代碼來源:FloatView.java

示例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;
    }
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:14,代碼來源:TrackerWindowManager.java

示例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;
}
 
開發者ID:HitRoxxx,項目名稱:FloatingNew,代碼行數:11,代碼來源:FloatingActionMenu.java

示例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;
}
 
開發者ID:HitRoxxx,項目名稱:FloatingNew,代碼行數:12,代碼來源:FloatingActionButton.java

示例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);
        }
    }
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:41,代碼來源:TrackerWindowManager.java

示例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;

}
 
開發者ID:chengkun123,項目名稱:ReadMark,代碼行數:46,代碼來源:FlowLayout.java


注:本文中的android.graphics.PixelFormat.RGBA_8888屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。