Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

android - What is a rootView?

Hello I'm new in Android and I've opened a project with the default template Master detail flow but I don't know what is a rootView. I've search on developer.android.com but I don't really understood it ...

So if someone can explain me clearly what's this thing doing it would help me a lot.

Thanks !

Edit : there is the code !

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments().containsKey(ARG_ITEM_ID)) {
        mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
    }
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false);
    if (mItem != null) {
        mLinearLayout = (LinearLayout)findViewById(R.id.layout); 
    }
    return rootView;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

RootView is the View in which all the other views are placed. It is like the root node in a tree structure which is the parent to all the children.

For example, you have multiple Buttons in your layout which are placed inside a LinearLayout. Then LinearLayout is called the RootView as it would have the highest position in the structure and everything would have to be placed inside it.

Hope this clears your doubt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...