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