Created
November 22, 2013 16:43
-
-
Save NLMartian/7602972 to your computer and use it in GitHub Desktop.
Activity父类中加入子类内容的方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void setContentView(int rootViewId) { | |
LayoutInflater inflator = getLayoutInflater(); | |
ViewGroup allContent = (ViewGroup)inflator.inflate(R.layout.base_authenticated_screen, null); | |
ViewGroup content = ((ViewGroup)allContent.findViewById(R.id.screen_content)); // R.id.screen_content是放置子类内容的ViewGroup | |
content.removeAllViews(); | |
content.addView(inflator.inflate(rootViewId, null)); | |
super.setContentView(allContent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment