本文整理汇总了Java中android.view.WindowManager.updateViewLayout方法的典型用法代码示例。如果您正苦于以下问题:Java WindowManager.updateViewLayout方法的具体用法?Java WindowManager.updateViewLayout怎么用?Java WindowManager.updateViewLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.WindowManager
的用法示例。
在下文中一共展示了WindowManager.updateViewLayout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setVisibility
import android.view.WindowManager; //导入方法依赖的package包/类
private void setVisibility(Boolean visible) {
WindowManager windowManager = (WindowManager) this.context.getSystemService("window");
LayoutParams params = (LayoutParams) this.renderView.getLayoutParams();
if (visible.booleanValue()) {
params.x = 0;
} else {
params.x = this.FAR_AWAY;
}
windowManager.updateViewLayout(this.renderView, params);
}
示例2: onTouchEvent
import android.view.WindowManager; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mLastX = (int) event.getRawX();
mLastY = (int) event.getRawY();
mFirstX = mLastX;
mFirstY = mLastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - mLastX;
int deltaY = (int) event.getRawY() - mLastY;
mLastX = (int) event.getRawX();
mLastY = (int) event.getRawY();
int totalDeltaX = mLastX - mFirstX;
int totalDeltaY = mLastY - mFirstY;
if (mIsMoving
|| Math.abs(totalDeltaX) >= MOVE_THRESHOLD
|| Math.abs(totalDeltaY) >= MOVE_THRESHOLD) {
mIsMoving = true;
WindowManager windowMgr = mWeakRef.get().mWindowManager;
WindowManager.LayoutParams parm = mWeakRef.get().mWindowParam;
if (event.getPointerCount() == 1 && windowMgr != null) {
parm.x -= deltaX;
parm.y -= deltaY;
windowMgr.updateViewLayout(this, parm);
}
}
break;
case MotionEvent.ACTION_UP:
mIsMoving = false;
break;
}
return true;
}
示例3: enableTouchOnRootView
import android.view.WindowManager; //导入方法依赖的package包/类
void enableTouchOnRootView(boolean enableTouch) {
WindowManager wm = (WindowManager) this.context.getSystemService("window");
LayoutParams layoutParams = (LayoutParams) this.rootView.getLayoutParams();
boolean isTouchEnabled = (layoutParams.flags & 16) == 0;
if (isTouchEnabled && !enableTouch) {
layoutParams.flags |= 16;
wm.updateViewLayout(this.rootView, layoutParams);
} else if (!isTouchEnabled && enableTouch) {
layoutParams.flags &= -17;
wm.updateViewLayout(this.rootView, layoutParams);
}
}
示例4: onCreate
import android.view.WindowManager; //导入方法依赖的package包/类
public void onCreate() {
super.onCreate();
sFloatingPlayerService = this;
mAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mSubtitleSizeDefault = getResources().getInteger(R.integer.player_pref_subtitle_size_default);
mSubtitleVPosDefault = getResources().getInteger(R.integer.player_pref_subtitle_vpos_default);
mSubtitleColorDefault = Color.parseColor(getResources().getString(R.string.subtitle_color_default));
bindService(new Intent(this, PlayerService.class), mPlayerServiceConnection, BIND_AUTO_CREATE);
mWindowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
AppState.addOnForeGroundListener(this);
IntentFilter filter = new IntentFilter();
filter.addAction("DISPLAY_FLOATING_PLAYER");
filter.addAction(PlayerService.PLAY_INTENT);
filter.addAction(PlayerService.PAUSE_INTENT);
filter.addAction(PlayerService.EXIT_INTENT);
filter.addAction(PlayerService.FULLSCREEN_INTENT);
mReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
if("DISPLAY_FLOATING_PLAYER".equals(intent.getAction())) {
if (mParamsF.width == 1) {
mParamsF.width = mLastWidth;
mParamsF.height = mLastHeight;
}
mParamsF.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
mFloatingPlayerRootView.setAlpha(1);
mSubtitleManager.setScreenSize(mParamsF.width, mParamsF.height);
mWindowManager.updateViewLayout(mFloatingPlayerRootView, mParamsF);
PlayerService.sPlayerService.startStatusbarNotification(false);
}
else if(PlayerService.PLAY_INTENT.equals(intent.getAction())){
Player.sPlayer.start();
}
else if(PlayerService.PAUSE_INTENT.equals(intent.getAction())){
Player.sPlayer.pause();
}
else if(PlayerService.EXIT_INTENT.equals(intent.getAction())){
removeFloatingView(false);
}
else if(PlayerService.FULLSCREEN_INTENT.equals(intent.getAction())){
startPlayerActivity();
}
}
} ;
registerReceiver(mReceiver, filter);
}