1 public String TAG = null; 2 3 public AbstractActivity() { 4 TAG = this.getClass().getName(); 7 } 8 9 10 @Override 11 protected void onCreate(Bundle savedInstanceState) { 12 super.onCreate(savedInstanceState);14 15 //去掉title 16 requestWindowFeature(Window.FEATURE_NO_TITLE); 17 //强制竖屏 18 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 19 //设置软键盘不弹出 20 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 21 //ViewTree layout Listener soft keyBoard state 22 }
1 /** 2 * Called as part of the activity lifecycle when an activity is going into 3 * the background, but has not (yet) been killed. The counterpart to 4 * {@link #onResume}. 5 * 6 * <p>When activity B is launched in front of activity A, this callback will 7 * be invoked on A. B will not be created until A‘s {@link #onPause} returns, 8 * so be sure to not do anything lengthy here. 9 * 10 * <p>This callback is mostly used for saving any persistent state the 11 * activity is editing, to present a "edit in place" model to the user and 12 * making sure nothing is lost if there are not enough resources to start 13 * the new activity without first killing this one. This is also a good 14 * place to do things like stop animations and other things that consume a 15 * noticeable mount of CPU in order to make the switch to the next activity 16 * as fast as possible, or to close resources that are exclusive access 17 * such as the camera. 18 * 19 * <p>In situations where the system needs more memory it may kill paused 20 * processes to reclaim resources. Because of this, you should be sure 21 * that all of your state is saved by the time you return from 22 * this function. In general {@link #onSaveInstanceState} is used to save 23 * per-instance state in the activity and this method is used to store 24 * global persistent data (in content providers, files, etc.) 25 * 26 * <p>After receiving this call you will usually receive a following call 27 * to {@link #onStop} (after the next activity has been resumed and 28 * displayed), however in some cases there will be a direct call back to 29 * {@link #onResume} without going through the stopped state. 30 * 31 * <p><em>Derived classes must call through to the super class‘s 32 * implementation of this method. If they do not, an exception will be 33 * thrown.</em></p> 34 * 35 * @see #onResume 36 * @see #onSaveInstanceState 37 * @see #onStop 38 */ 39 protected void onPause() { 40 mCalled = true; 41 }
1 r.window = r.activity.getWindow(); 2 View decor = r.window.getDecorView(); 3 decor.setVisibility(View.INVISIBLE); 4 ViewManager wm = a.getWindowManager(); 5 WindowManager.LayoutParams l = r.window.getAttributes(); 6 a.mDecor = decor; 7 l.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION; 8 l.softInputMode |= forwardBit; 9 if (a.mVisibleFromClient) { 10 a.mWindowAdded = true; 11 wm.addView(decor, l); 12 }
good
时间: 2024-12-28 20:18:30