当前位置: 首页>>代码示例>>Java>>正文


Java Window.getAttributes方法代码示例

本文整理汇总了Java中android.view.Window.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java Window.getAttributes方法的具体用法?Java Window.getAttributes怎么用?Java Window.getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.Window的用法示例。


在下文中一共展示了Window.getAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: slideToChangeBrightness

import android.view.Window; //导入方法依赖的package包/类
protected void slideToChangeBrightness(float deltaY) {
    mCenterView.setVisibility(VISIBLE);
    hide();
    mCenterView.setProVisibility(View.VISIBLE);
    Window window = WindowUtil.scanForActivity(getContext()).getWindow();
    WindowManager.LayoutParams attributes = window.getAttributes();
    mCenterView.setIcon(R.drawable.ic_action_brightness);
    int height = getMeasuredHeight();
    if (mBrightness == -1.0f) mBrightness = 0.5f;
    float brightness = deltaY * 2 / height * 1.0f + mBrightness;
    if (brightness < 0) {
        brightness = 0f;
    }
    if (brightness > 1.0f) brightness = 1.0f;
    int percent = (int) (brightness * 100);
    mCenterView.setTextView(percent + "%");
    mCenterView.setProPercent(percent);
    attributes.screenBrightness = brightness;
    window.setAttributes(attributes);
}
 
开发者ID:dueeeke,项目名称:dkplayer,代码行数:21,代码来源:BaseVideoController.java

示例2: onCreate

import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = getLayoutInflater().inflate(R.layout.view_dialog_select, null);
    setContentView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    Window window = getWindow();
    // 设置显示动画
    if (window != null) {
        window.setWindowAnimations(R.style.main_menu_animStyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = mActivity.getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = LayoutParams.MATCH_PARENT;
        wl.height = LayoutParams.WRAP_CONTENT;
        // 设置显示位置
        onWindowAttributesChanged(wl);
    }
    initViews();
}
 
开发者ID:yangchong211,项目名称:YCDialog,代码行数:21,代码来源:CustomSelectDialog.java

示例3: showRecordDialog

import android.view.Window; //导入方法依赖的package包/类
private void showRecordDialog(MediaProjection mediaProjection, String filePath, boolean isRecordAudio) {
        if (mRecordDialog == null) {
            mRecordDialog = new RecordScreenDialog(getContext(), R.style.record_dialog);
            mRecordDialog.setFilePath(filePath);
            Window window = mRecordDialog.getWindow();
            window.setGravity(Gravity.BOTTOM);
            WindowManager.LayoutParams layoutParams = window.getAttributes();
            layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
            layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
            window.setAttributes(layoutParams);
            mRecordDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
//                    showSystemUI();
                }
            });
        }
        //第二个参数表述是否录制音频数据
        mRecordDialog.setActivityResult(mediaProjection, isRecordAudio);
        mRecordDialog.setIShareLivePlayer(mIShareLivePlayer);
        mRecordDialog.setCallback(mCallback);
        mRecordDialog.show();
    }
 
开发者ID:sunshinecoast,项目名称:ScreenRecordCaptureMaster,代码行数:24,代码来源:RecordSyntheticView.java

示例4: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    if (getDialog()==null){
        this.dismiss();
        return;
    }

    Window window = getDialog().getWindow();
    WindowManager.LayoutParams params = window.getAttributes();

    params.dimAmount = getDimAmount();
    params.width = WindowManager.LayoutParams.MATCH_PARENT;
    if (getHeight() > 0) {
        params.height = getHeight();
    } else {
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
    }
    params.gravity = Gravity.BOTTOM;

    window.setAttributes(params);
}
 
开发者ID:tututututututu,项目名称:BaseCore,代码行数:24,代码来源:TBaseButtomFragment.java

示例5: setWindowFlag

import android.view.Window; //导入方法依赖的package包/类
private static void setWindowFlag(Activity activity, final int bits, boolean on) {
    Window win = activity.getWindow();
    WindowManager.LayoutParams winParams = win.getAttributes();
    if (on) {
        winParams.flags |= bits;
    } else {
        winParams.flags &= ~bits;
    }
    win.setAttributes(winParams);
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:11,代码来源:SystemBarUtil.java

示例6: initDialogWidth

import android.view.Window; //导入方法依赖的package包/类
private void initDialogWidth() {
    Window window = getWindow();
    if (window == null) {
        return;
    }
    WindowManager.LayoutParams wmlp = window.getAttributes();
    wmlp.width = ViewGroup.LayoutParams.MATCH_PARENT;
    window.setAttributes(wmlp);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:10,代码来源:QMUIDialog.java

示例7: show

import android.view.Window; //导入方法依赖的package包/类
@Override
public void show() {
    Window dialogWindow = getWindow();
    LayoutParams lp = dialogWindow.getAttributes();
    dialogWindow.setGravity(Gravity.LEFT | Gravity.BOTTOM);
    WindowManager m = context.getWindowManager();
    Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
    lp.width = d.getWidth();
    lp.x = 0;
    lp.y = 0;
    dialogWindow.setAttributes(lp);
    super.show();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:14,代码来源:CaculatorDialog.java

示例8: show

import android.view.Window; //导入方法依赖的package包/类
@Override
public void show() {
    Window dialogWindow = getWindow();
    LayoutParams lp = dialogWindow.getAttributes();
    lp.width = LayoutParams.MATCH_PARENT;
    lp.height = LayoutParams.MATCH_PARENT;
    /*WindowManager m = context.getWindowManager();
    Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
    lp.width = d.getWidth();*/
    dialogWindow.setAttributes(lp);
    EventBus.getDefault().register(this);
    super.show();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:14,代码来源:NaviVoiceInputDialog.java

示例9: initWindowParams

import android.view.Window; //导入方法依赖的package包/类
private void initWindowParams() {
    Window dialogWindow = getWindow();
    // 获取屏幕宽、高用
    WindowManager wm = (WindowManager) mContext
            .getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
    lp.width = (int) (display.getWidth() * 0.65); // 宽度设置为屏幕的0.65

    dialogWindow.setGravity(Gravity.CENTER);
    dialogWindow.setAttributes(lp);
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:13,代码来源:CommentDialog.java

示例10: FlymeSetStatusBarLightMode

import android.view.Window; //导入方法依赖的package包/类
/**
 * 设置状态栏图标为深色和魅族特定的文字风格
 * 可以用来判断是否为Flyme用户
 * @param window 需要设置的窗口
 * @param dark 是否把状态栏字体及图标颜色设置为深色
 * @return  boolean 成功执行返回true
 *
 */
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
    boolean result = false;
    if (window != null) {
        try {
            WindowManager.LayoutParams lp = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField("meizuFlags");
            darkFlag.setAccessible(true);
            meizuFlags.setAccessible(true);
            int bit = darkFlag.getInt(null);
            int value = meizuFlags.getInt(lp);
            if (dark) {
                value |= bit;
            } else {
                value &= ~bit;
            }
            meizuFlags.setInt(lp, value);
            window.setAttributes(lp);
            result = true;
        } catch (Exception e) {

        }
    }
    return result;
}
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:36,代码来源:StatusBarUtil.java

示例11: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    if (mIsTransparent) {
        Window window = getDialog().getWindow();
        WindowManager.LayoutParams windowParams = window.getAttributes();
        windowParams.dimAmount = 0.0f;
        window.setAttributes(windowParams);
    }
}
 
开发者ID:open-android,项目名称:GuideDialog,代码行数:11,代码来源:ItHeiMaDialog.java

示例12: setWindowParams

import android.view.Window; //导入方法依赖的package包/类
public void setWindowParams(int width) {
    Window window = getWindow();
    LayoutParams params = window.getAttributes();
    if (width <= 0) {
        width = -1;
    }
    params.width = width;
    params.height = -1;
    params.gravity = 80;
    window.setAttributes(params);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:CustomBaseDialog.java

示例13: setTranslucentStatus

import android.view.Window; //导入方法依赖的package包/类
@TargetApi(19)
private void setTranslucentStatus(boolean on) {
    Window win = getWindow();
    WindowManager.LayoutParams winParams = win.getAttributes();
    final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
    if (on) {
        winParams.flags |= bits;
    } else {
        winParams.flags &= ~bits;
    }
    win.setAttributes(winParams);
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:13,代码来源:BaseActivity.java

示例14: setMatchParent

import android.view.Window; //导入方法依赖的package包/类
public BaseDialog setMatchParent() {
    Window dialogWindow = getWindow();
    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    dialogWindow.setAttributes(lp);
    return this;
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:8,代码来源:BaseDialog.java

示例15: updateLayoutHeightOf

import android.view.Window; //导入方法依赖的package包/类
public static void updateLayoutHeightOf(final Window window, final int layoutHeight) {
    final WindowManager.LayoutParams params = window.getAttributes();
    if (params != null && params.height != layoutHeight) {
        params.height = layoutHeight;
        window.setAttributes(params);
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:8,代码来源:ViewLayoutUtils.java


注:本文中的android.view.Window.getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。