Finally, the file starting with M is reached. That's right. Finally, you can meet the most familiar main file. Go to the topic directly.
1. main: Beyond my expectation, the main file of oschina is very simple, with only a few lines of code. When I look at it, it's all <include> labels. I will understand it in an instant, all references the previously defined code. Because the code is not long, I will copy it all.
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white"> <include layout="@layout/main_header" /> <net.oschina.app.widget.ScrollLayout android:id="@+id/main_scrolllayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <include layout="@layout/frame_news" /> <include layout="@layout/frame_question" /> <include layout="@layout/frame_tweet" /> <include layout="@layout/frame_active" /> </net.oschina.app.widget.ScrollLayout> <include layout="@layout/main_footer" /> </LinearLayout>
Linearlayout is an old face, and then the main_header file is referenced. The file is described below, and then the net. oschina. app. widget. scrolllayout package, I think it is necessary to carefully learn about the use of the package here. Then there are several frame files introduced in the last two articles: information, Q & A, moving, and my space. The following is a reference to the main_footer file.
2. main_header: the code is quite simple. Here we use relative layout. below is the text of an image that represents "information. (There are progress bars and search icons in the new version. The progress bar of the old version is very small and almost invisible when the information pattern is delivered.) Next, there are three button image labels, indicating the latest information respectively, the latest blog and recommended reading are based on different versions. The three patterns of the old version implement different functions, while the new version completely uses the information page as the homepage, the page code is different.
3. main_footer: This page is also very simple. The footer file is displayed with five icons. The code is image, vertical line, picture, and vertical line... However, the image here uses the radiobutton tag, which is of great interest to me. Obviously, the single-stick label here means that you can only press one pattern at the same time.
After reading main with expectation, it took only 10 minutes to interpret it. I have to say that the reference here has played a great role, reducing the amount of code and improving the code efficiency, this is a shortcut to learning Java and Android.
4. message_detail: the code prefixes of these files are called Chat details. The specific function is in the message section of my space. This file is a major file like the main file above, and several other files are part of it.
Linearlayout layout. <include> the label references the header and uses the package. net. oschina. app. widget. pulltorefreshlistview: these packages are really complicated. Press ctrl to see the complete details. The following is the <include> label reference footer, which is complete.
5. message_detail_footer: footer, first on:
The viewswitcher label implements the animation effect, linear layout, and the background is a black image. Then it is a white image file with the message being sent. The linear layout below is generated after you press the send message image, a text edit box, and a send button.
6. message_detail_header: the header file, as shown in the figure below:
This is framelayout, framework layout, but after I read the files on the internet, I found that its name tends to be "single frame layout ": in this layout, each added child control is placed in the upper left corner of the layout and overwrites the upper layer of the previous child control. In fact, I found that, compared with the previous footer, the header should be more complex, so it may not be good to simply use the relative layout. The background is added to the layout, and the image control is used to indicate "return ",
android:layout_gravity="left|center"
The text control in the middle represents the dialog with whom
android:layout_gravity="center"
Next is a progress bar control, which indicates refresh
android:layout_gravity="right|center"
The above three codes indicate the convenience of frame layout. If linear layout is used, it is certainly not that simple.
Right, there is also an image control that indicates refresh, which coincides with the progress bar. I will not outline it here.
7. message_forward
It is strange that the header is also defined here. Why does it return to the linear layout? Is my above speculation incorrect? I thought about it. This is not the header, but the definition of a header file. There is a linear layout below to complete the entire page, so this is the case. The following lenearlayout writes the middle part of the image. The text control "Send:" is displayed in the text editing box. The Android: hint property is displayed in the text editing box. "Enter the nickname of the recipient ", the next step of linear layout is completed. The text control is "message content". The text edit box attribute is Android: hint = "Enter the message content ".
8. message_pub.
9. message_lisitem and message_detail_listitem, so here we will discuss the code of the former.
Linear layout: The image control represents the user's profile picture and the linear layout. A dialog box is used as the background, followed by a text control to represent the content. below is the relative layout... This can also be used in the past, so that a good layout can be achieved in a background. The following three text controls implement the client, time, and number of comments.
This article has been written for quite a long time. Looking at the layout folder, it is written in half. The speed of the article in the past two days is still a little slow ~
OK, not to be continued!