美文网首页
Instagram项目profile页面实战(三)

Instagram项目profile页面实战(三)

作者: 送外卖的程序员 | 来源:发表于2020-02-20 21:53 被阅读0次

之前模仿Youtube大神做Instagram实战项目,已经更新了两篇。这一篇主要是记录下如何做Profile页面,也就是自己的主页部分。

一:布局方面实现

    1.    activity_profile.xml主页布局

            主布局为CoordinatorLayout,主页面代码中不放入任何关于页面要展示的控件,而是通过include元素调用从而减低耦合度。

            

activity_profile.xml代码

            <include layout="@layout/layout_center_profile_viewpager" /> 页面的Top部分和Middle部分写在了layout_center_profile_viewpager中。

            <include layout="@layout/layout_bottom_navigation_view" /> 页面的BottomNavgaitonBar,在之前的文章已经放出了代码,直接调用就可以了。

    2.    layout_center_profile_viewpager.xml布局:

           Top部分通过include元素调用一个ToolBar的xml布局

layout_center_profile_viewpager.xml的Top部分代码

           Middle部分分为三个部分:

                1.    头像图片:CircleImageView组件

                        通过include元素调用一个显示用户粉丝数量,关注用户等信息的xml布局:<include layout="@layout/layout_snippet_top_profile" />

                2.    由LinearLayout和orientation='vertical'的布局和三个TextView组成的用来显示用户基本信息描述的部分

                    

用户信息描述部分代码

                3.    最后一个部分是用GridView来显示用户上传过得instagram图片。

GridView部分显示用户已上传的图片

              Bottom部分依旧调用写好的BottomNavigationView即可

        下图是整体的布局的效果:

        

布局效果

       3.    layout_snippet_top_profilebar.xml布局:

              上图中的“赵四”部分是由toolbar控件完成的

                

layout_snippet_top_profilebar.xml代码

                        android:background="@drawable/white_grey_border_bottom"是我们在之前写好的actionbar的border样式。

        4. layout_snippet_top_profile.xml布局:

            

layout_snippet_top_profile.xml第一部分

            

            

layout_snippet_top_profile.xml第二部分 layout_snippet_top_profile.xml第三部分

    上述代码主布局用了ConstraintLayout,为每个TextView设置了边框的constraint,这样在使用不同尺寸屏幕时能够达到很好的比例效果。

相关文章

  • Instagram项目profile页面实战(三)

    之前模仿Youtube大神做Instagram实战项目,已经更新了两篇。这一篇主要是记录下如何做Profile页面...

  • flutter页面练习_1

    熟能生巧,跟着老外写页面第1篇 完成效果: 项目结构: mian.dart: profile_screen.dar...

  • android loading 封装

    [Android ]打造 Android 原生 Loading,简单但强大!Android项目实战 加载数据时页面...

  • React 16.4 开发简书项目[9]

    第9章 项目实战:详情页面和登录功能开发 9-1 详情页面布局 src——pages————detail—————...

  • 静态页面项目实战训练

    (一) 要求做项目之前必细心去看: 实战训练问题汇总做完项目在看看这个视频,讲解如何做实战1的页面图标可使用 ic...

  • Mac环境变量修改

    1,打开终端 touch .bash_profile open -e .bash_profile 2,打开的页面输...

  • 高仿Instagram拖动条

    之前做项目的时候,有个图片编辑页面,用到拖动条添加编辑效果。老板很喜欢Instagram那种拖动条的效果,0点从中...

  • vue单页面项目实战

    1. 组件嵌套 将单文件组件组合在一起有两种方式,一种是嵌套方式,一种用路由的方式。嵌套的方式代码如下:如下,假设...

  • Datawhale 爬虫学习笔记4

    Task4(2天) 4.1 实战大项目 实战大项目:模拟登录丁香园,并抓取论坛页面所有的人员基本信息与回复帖子内容...

  • Spring实战(三)-高级装配

    本文基于《Spring实战(第4版)》所写。 环境与profile 数据源的有三种连接配种,分别是 Spring为...

网友评论

      本文标题:Instagram项目profile页面实战(三)

      本文链接:https://www.haomeiwen.com/subject/jtvxqhtx.html