找回密码
 立即注册
我们都认识,Android上的界面展现都是通过Activity实现的,Activity实在是太常用了,我相信我们都现已十分理解了,这儿就不再赘述。可是Activity也有它的局限性,同样的界面在手机上显示或许很美观,在平板上就未必了,由于平板的屏幕十分大,手机的界面放在平板上或许会有过分被拉长、控件距离过大等状况。这个时候更好的体会效果是在Activity中嵌入小Activity,然后每个小Activity又可以具有自己的布局。因而,我们今日的主角Fragment登场了。为了让界面可以在平板上更好地展现,Android在3.0版本引入了Fragment(碎片)功能,它十分类似于Activity,可以像Activity相同包括布局。Fragment通常是嵌套在Activity中使用的,现在想象这种场景:有两个Fragment,Fragment1包括了一个ListView,每行显示一本书的标题。Fragment2包括了TextView和ImageView,来显示书的具体内容和图片。

(We all know that the interface display on Android is achieved through Activity. Activity is so common that I believe we have fully understood it now. I won't repeat it here. However, Activity also has its limitations. The same interface may be beautiful on the mobile phone, but not necessarily on the tablet. Because the screen of the tablet is very large, the interface of the mobile phone on the tablet may be excessively stretched and the distance between controls is too large. At this time, it is better to experience the effect that small activities are embedded in activities, and then each small Activity can have its own layout. Therefore, today's leading character Fragment appeared. In order to better display the interface on the tablet, Android introduced the Fragment function in version 3.0, which is very similar to Activity and can include the layout like Activity. Fragments are usually nested in activities. Now imagine this scenario: there are two fragments, Fragment1 includes a ListView, and each row displays a book title. Fragment2 includes TextView and ImageView to display the specific contents and pictures of the book.)

[下载]10083450892.rar




上一篇:Android AsyncTask完全解析
下一篇:Material Design设计语言中文版