本文整理汇总了Java中android.view.Window.requestFeature方法的典型用法代码示例。如果您正苦于以下问题:Java Window.requestFeature方法的具体用法?Java Window.requestFeature怎么用?Java Window.requestFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Window
的用法示例。
在下文中一共展示了Window.requestFeature方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDialog
import android.view.Window; //导入方法依赖的package包/类
private void initDialog() {
contentLayout = new FrameLayout(activity);
contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
contentLayout.setFocusable(true);
contentLayout.setFocusableInTouchMode(true);
//contentLayout.setFitsSystemWindows(true);
dialog = new Dialog(activity);
dialog.setCanceledOnTouchOutside(false);//触摸屏幕取消窗体
dialog.setCancelable(false);//按返回键取消窗体
dialog.setOnKeyListener(this);
dialog.setOnDismissListener(this);
Window window = dialog.getWindow();
if (window != null) {
window.setGravity(Gravity.BOTTOM);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//AndroidRuntimeException: requestFeature() must be called before adding content
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setContentView(contentLayout);
}
setSize(screenWidthPixels, WRAP_CONTENT);
}
示例2: init
import android.view.Window; //导入方法依赖的package包/类
private void init(Context context) {
contentLayout = new FrameLayout(context);
contentLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
contentLayout.setFocusable(true);
contentLayout.setFocusableInTouchMode(true);
dialog = new android.app.Dialog(context);
dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
dialog.setCancelable(true);//按返回键取消窗体
Window window = dialog.getWindow();
window.setGravity(Gravity.BOTTOM);//位于屏幕底部
window.setWindowAnimations(R.style.Animation_Popup);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//android.util.AndroidRuntimeException: requestFeature() must be called before adding content
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setContentView(contentLayout);
}
示例3: onCreateDialog
import android.view.Window; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
// Idea from here
// http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html
Dialog dialog = new Dialog(mContext);
Window window = dialog.getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return dialog;
}
示例4: onCreateView
import android.view.Window; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.item_highlight, container);
v.findViewById(R.id.page_part_number).setVisibility(View.GONE);
v.findViewById(R.id.date_time).setVisibility(View.GONE);
Dialog dialog = getDialog();
Window window = dialog.getWindow();
if (window != null) {
window.setGravity(Gravity.BOTTOM);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.requestFeature(Window.FEATURE_NO_TITLE);
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
return v;
}
示例5: initDialog
import android.view.Window; //导入方法依赖的package包/类
private void initDialog() {
contentLayout = new FrameLayout(activity);
contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
contentLayout.setFocusable(true);
contentLayout.setFocusableInTouchMode(true);
dialog = new Dialog(activity);
dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
dialog.setCancelable(true);//按返回键取消窗体
dialog.setOnKeyListener(this);
dialog.setOnDismissListener(this);
Window window = dialog.getWindow();
if (window != null) {
window.setGravity(Gravity.BOTTOM);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//AndroidRuntimeException: requestFeature() must be called before adding content
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setContentView(contentLayout);
}
setSize(screenWidthPixels, WRAP_CONTENT);
}
示例6: onCreateView
import android.view.Window; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.folderchooser_dialog, null);
Window window = getDialog().getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
// retrieve display dimensions
Rect displayRectangle = new Rect();
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
int w = (int) (displayRectangle.width() * 0.95);
int h = (int) (displayRectangle.height() * 0.9);
window.setLayout(w, h);
WindowManager.LayoutParams params = window.getAttributes();
window.setAttributes(params);
return view;
}
示例7: setSceneTransitionAnimation
import android.view.Window; //导入方法依赖的package包/类
public void setSceneTransitionAnimation() {
if (Build.VERSION.SDK_INT < 21) return;
Transition slide = new Slide(Gravity.RIGHT);
slide.excludeTarget(android.R.id.statusBarBackground, true);
slide.excludeTarget(android.R.id.navigationBarBackground, true);
Window window = getWindow();
window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
window.setExitTransition(slide);
window.setEnterTransition(slide);
window.setTransitionBackgroundFadeDuration(getResources()
.getInteger(android.R.integer.config_longAnimTime));
window.setBackgroundDrawableResource(android.R.color.transparent);
}
示例8: initPushInAnim
import android.view.Window; //导入方法依赖的package包/类
private void initPushInAnim() {
Window window = getWindow();
window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
TransitionInflater inflater = TransitionInflater.from(mContext);
Transition pushDownIn = inflater.inflateTransition(R.transition.explode_in);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setEnterTransition(pushDownIn); // 第一次进入时使用
window.setReenterTransition(pushDownIn); // 再次进入时使用
window.setExitTransition(pushDownIn);
}
}
示例9: onCreateView
import android.view.Window; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//设置无标题
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置从底部弹出
Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setAttributes(params);
return null;
}
示例10: onCreateView
import android.view.Window; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.folderchooser_dialog, null);
Window window = getDialog().getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
//window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//window.setGravity(Gravity.TOP | Gravity.LEFT);
// retrieve display dimensions
Rect displayRectangle = new Rect();
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
int w = (int) (displayRectangle.width() * 0.95);
int h = (int) (displayRectangle.height() * 0.9);
window.setLayout(w, h);
// after that, setting values for x and y works "naturally"
WindowManager.LayoutParams params = window.getAttributes();
//params.x = 280;
//params.y = 280;
//params.height = 200;
//params.dimAmount = 0f;
window.setAttributes(params);
return view;
}
示例11: loadActivityStyle
import android.view.Window; //导入方法依赖的package包/类
/**
* 基本样式
*/
protected void loadActivityStyle() {
final Window window = getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
final ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.hide();
}
}
示例12: onCreate
import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
/** NO_TITLE SCREEN_ON FULLSCREEN */
Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
win.requestFeature(Window.FEATURE_NO_TITLE);
/**摄像头方向*/
isOritationLanscape = getIntent().getBooleanExtra("oritation_landscape", false);
if (isOritationLanscape) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.activity_streaming_landscape);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_streaming_portrait);
}
/**推流视频宽度*/
mVideoWidth = getIntent().getIntExtra("res_w", 1280);
/**推流视频高度*/
mVideoHeight = getIntent().getIntExtra("res_h", 720);
/**视频帧率*/
mFrameRate = getIntent().getIntExtra("frame_rate", 15);
/**视频码率*/
mBitrate = getIntent().getIntExtra("bitrate", 1024) * 1000;
/**推流地址*/
mStreamingUrl = getIntent().getStringExtra("push_url");
initUIElements();
/**摄像头为前置摄像头*/
mCurrentCamera = LiveConfig.CAMERA_FACING_FRONT;
/**是否开始散光灯*/
isFlashOn = false;
initUIEventHandler();
/**推流状态的监听*/
initStateListener();
/**初始化推流会话*/
initRTMPSession(mCameraView.getHolder());
mDetector = new GestureDetectorCompat(this, this);
mDetector.setOnDoubleTapListener(this);
}