setContentVIew学习
来源:互联网 发布:linux文件目录绿色标 编辑:程序博客网 时间:2024/06/03 15:18
1.setContentView(int id)
2.Window是一个抽象出来区域的概念,意思是这个区域可以添加很多view
那么抽象类的实现是谁,这里是PhoneWindow
3初始化Activity有一个attach方法
mWindow = new PhoneWindow(this, window, activityConfigCallback);
4原来就是PhoneWindow
public void setContentView(View view, ViewGroup.LayoutParams params) {
if (mContentParent == null) {
installDecor();
} else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
mContentParent.removeAllViews();
}
mContentParent.addView(view, params);
5学习一下什么叫DecorView本质是一个FrameLayout
mContentParent是一个ViewGroup是content对应的布局
6new DecorView(context, featureId, this, getAttributes());
ViewGroup contentParent = (ViewGroup)findViewById(ID_ANDROID_CONTENT);
final DecorContentParent decorContentParent = (DecorContentParent) mDecor.findViewById( R.id.decor_content_parent); if (decorContentParent != null) { mDecorContentParent = decorContentParent;
6进入ActivityThead 每个Window最终由WindowManager负责添加,
而addView会new 一个ViewRootImpl负责重绘
final void handleResumeActivity(IBinder token,
boolean clearHide, boolean isForward, boolean reallyResume, int seq, String reason) {
ActivityClientRecord r = mActivities.get(token);
if (!checkAndUpdateLifecycleSeq(seq, r, “resumeActivity”)) {
return;
}
// If we are getting ready to gc after going to the background, well // we are back active so skip it. unscheduleGcIdler(); mSomeActivitiesChanged = true; // TODO Push resumeArgs into the activity for consideration r = performResumeActivity(token, clearHide, reason); if (r != null) { final Activity a = r.activity; if (localLOGV) Slog.v( TAG, "Resume " + r + " started activity: " + a.mStartedActivity + ", hideForNow: " + r.hideForNow + ", finished: " + a.mFinished); final int forwardBit = isForward ? WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0; // If the window hasn't yet been added to the window manager, // and this guy didn't finish itself or start another activity, // then go ahead and add the window. boolean willBeVisible = !a.mStartedActivity; if (!willBeVisible) { try { willBeVisible = ActivityManager.getService().willActivityBeVisible( a.getActivityToken()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } if (r.window == null && !a.mFinished && willBeVisible) { r.window = r.activity.getWindow(); View decor = r.window.getDecorView(); decor.setVisibility(View.INVISIBLE); ViewManager wm = a.getWindowManager(); WindowManager.LayoutParams l = r.window.getAttributes(); a.mDecor = decor; l.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION; l.softInputMode |= forwardBit; if (r.mPreserveWindow) { a.mWindowAdded = true; r.mPreserveWindow = false; // Normally the ViewRoot sets up callbacks with the Activity // in addView->ViewRootImpl#setView. If we are instead reusing // the decor view we have to notify the view root that the // callbacks may have changed. ViewRootImpl impl = decor.getViewRootImpl(); if (impl != null) { impl.notifyChildRebuilt(); } } if (a.mVisibleFromClient) { if (!a.mWindowAdded) { a.mWindowAdded = true; wm.addView(decor, l);
- setContentVIew学习
- Android学习笔记:浅析setContentView
- 学习android Activity的setContentView
- setContentView
- setContentView
- setContentView
- setContentView
- setContentView
- setContentView
- setContentView
- 学习笔记-setContentView错误 找不到R.layout.activity
- Android View系统学习——从setContentView说开来
- android应用程序窗口框架学习(4)-从setcontentview说起
- android Activity.setContentView和Window PhoneWindow类学习
- setContentView( )方法
- setContentView剖析
- setContentView方法
- setContentView剖析
- 基于FPGA PLL锁相环实现及示波器波形失真分析
- Windows 安装 curl
- FLASK-SQLALchemy 的介绍与安装
- Matlab以MEX方式调用C源代码
- MOOC清华《面向对象程序设计》第5章:OOP版谁做的好事
- setContentVIew学习
- Day60-Oracle04
- 设计模式C++版:第二十一式观察者模式
- Linux nohup命令分析
- 引用和指针有什么区别,汇编分析(最真实)
- 发布上线前,先小秀一把俺的64位浏览器,速度那觉对是杠杠滴,上youtube,上google不费劲
- Potplayer制作视频缩略图的方法
- Java接口
- Java方法重写和方法重载