写点什么

Android 企业级实战 - 界面篇 -2

用户头像
Android架构
关注
发布于: 2021 年 11 月 07 日

二、实现前准备


======================================================================


1.dimens.xml 文件内容(与第一个案例为同文件)




不占字了,请于第一篇自取


Android企业级实战-界面篇-1


2.ids.xml 文件内容(此案例可用)




<item type="id" name="user_profile_layout" />


<item type="id" name="profile_cover" />


<item type="id" name="blog_tag" />


<item type="id" name="user_data" />


<item type="id" name="arrow" />


<item type="id" name="arrow_img" />


<item type="id" name="blog_name_text" />


<item type="id" name="user_focus_layout" />


<item type="id" name="user_focus_num" />


<item type="id" name="user_fans_layout" />


<item type="id" name="user_fans_num" />


<item type="id" name="new_fans_tip" />


<item type="id" name="user_fav_num" />


<item type="id" name="user_tv_recommend_num" />


<item type="id" name="ll_owner_like" />


<item type="id" name="iv_like_icon" />


<item type="id" name="ll_owner_fav" />


<item type="id" name="iv_fav_icon" />


3.colors.xml 文件内容(此案例可用)




<color name="jimeng_background_primary_light">#ffffffff</color>


<color name="jimeng_white">@color/jimeng_background_primary_light</color>


<color name="jimeng_text_primary_light">#ff2e2e2e</color>


<color name="jimeng_black">@color/jimeng_text_primary_light</color>


<color name="jimeng_red_light">#ffff6c93</color>


<color name="jimeng_text_quarternary_light">#ffcccccc</color>


<color name="color_dddddd">#ffdddddd</color>


<color name="jimeng_background_secondary_light">#fff5f5f5</color>


<color name="jimeng_separator_line_light">#ffededed</color>


<color name="jimeng_gray05">@color/jimeng_separator_line_light</color>


<color name="color_ffffff">#ffffffff</color>


<color name="jimeng_gray03">@color/jimeng_text_quarternary_light</color>


三、实现


===================================================================


1.user_profile_layout.xml(第一个模块)




<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"


android:id="@id/user_profile_layout"


android:layout_width="fill_parent"


android:layout_height="100.0dip"


android:clickable="true"


android:clipChildren="false">


<ImageView


android:id="@id/profile_cover"


android:layout_width="fill_parent"


android:layout_height="fill_parent"


android:alpha="1.0" />


<ImageView


android:id="@id/image"


android:layout_width="72.0dip"


android:layout_height="72.0dip"


android:layout_marginLeft="24.0dip"


android:layout_marginTop="@dimen/jimeng_dp_32"


android:layout_marginRight="15.0dip"


android:src="@drawable/venda_default_icon_jimeng" />


<ImageView


android:id="@id/blog_tag"


android:layout_width="22.0dip"


android:layout_height="22.0dip"


android:layout_alignRight="@id/image"


android:layout_alignBottom="@id/image"


android:layout_marginTop="2.0dip"


android:scaleType="centerCrop" />


<RelativeLayout


android:id="@id/user_data"


android:layout_width="fill_parent"


android:layout_height="72.0dip"


android:layout_marginTop="36.0dip"


android:layout_toLeftOf="@id/arrow"


android:layout_toRightOf="@id/image"



<TextView


android:id="@id/blog_name_text"


android:layout_width="fill_parent"


android:layout_height="wrap_content"


android:layout_marginTop="4.0dip"


android:layout_marginRight="15.0dip"


android:duplicateParentState="true"


android:singleLine="true"


android:text="计蒙不吃鱼"


android:layout_centerVertical="true"


android:textColor="@color/jimeng_black"


android:textSize="@dimen/jimeng_dp_20"


android:textStyle="bold"/>


</RelativeLayout>


<RelativeLayout


android:id="@id/arrow"


android:layout_width="40.0dip"


android:layout_height="72.0dip"


android:layout_marginTop="36.0dip"


android:layout_alignParentRight="true"



<ImageView


android:id="@id/arrow_img"


android:layout_width="16.0dip"


android:layout_height="16.0dip"


android:layout_centerVertical="true"


android:layout_marginRight="24.0dip"


android:src="@drawable/common_icon_arrow_next_medium" />


</RelativeLayout>


</RelativeLayout>


效果图:



2.include_user_profile_feature.xml(第二个模块)




<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"


android:layout_width="fill_parent"


android:layout_height="fill_parent"


android:background="@color/white"


android:orientation="horizontal"


android:paddingTop="@dimen/jimeng_dp_16"


android:paddingBottom="@dimen/jimeng_dp_16">


<LinearLayout


android:id="@id/user_focus_layout"


android:layout_width="0.0dip"


android:layout_height="fill_parent"


android:layout_weight="1.0"


android:gravity="center"


android:orientation="vertical">


<TextView


android:id="@id/user_focus_num"


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:text="1024"


android:textColor="@color/jimeng_text_primary_light"


android:textSize="@dimen/jimeng_dp_17"


android:textStyle="bold" />


<TextView


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:layout_marginTop="@dimen/jimeng_dp_2"


android:text="关注"


android:textColor="@color/jimeng_text_quarternary_light"


android:textSize="@dimen/jimeng_dp_12"


android:textStyle="bold" />


</LinearLayout>


<RelativeLayout


android:id="@id/user_fans_layout"


android:layout_width="0.0dip"


android:layout_height="fill_pare


《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》
浏览器打开:qq.cn.hn/FTe 免费领取
复制代码


nt"


android:layout_weight="1.0"


android:gravity="center">


<RelativeLayout


android:layout_width="fill_parent"


android:layout_height="wrap_content">


<TextView


android:id="@id/user_fans_num"


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:layout_centerHorizontal="true"


android:text="1024"


android:textColor="@color/jimeng_text_primary_light"


android:textSize="@dimen/jimeng_dp_17"


android:textStyle="bold" />


<TextView


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:layout_below="@id/user_fans_num"


android:layout_centerHorizontal="true"


android:layout_marginTop="@dimen/jimeng_dp_2"


android:text="粉丝"


android:textColor="@color/jimeng_text_quarternary_light"


android:textSize="@dimen/jimeng_dp_12"


android:textStyle="bold" />


<TextView


android:id="@id/new_fans_tip"


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:layout_marginLeft="3.0dip"


android:layout_marginBottom="3.0dip"


android:layout_toRightOf="@id/user_fans_num"


android:text="+0"


android:textColor="@color/jimeng_red_light"


android:textSize="10.0dip"


android:visibility="gone" />


</RelativeLayout>


</RelativeLayout>


<LinearLayout


android:id="@id/user_fav_num"


android:layout_width="0.0dip"


android:layout_height="fill_parent"


android:layout_weight="1.0"


android:gravity="center"


android:orientation="vertical">


<TextView


android:id="@id/user_tv_recommend_num"


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:text="1024"


android:textColor="@color/jimeng_text_primary_light"


android:textSize="@dimen/jimeng_dp_17"


android:textStyle="bold" />


<TextView


android:layout_width="wrap_content"


android:layout_height="wrap_content"


android:layout_marginTop="@dimen/jimeng_dp_2"


android:text="推荐"


android:textColor="@color/jimeng_text_quarternary_light"


android:textSize="@dimen/jimeng_dp_12"


android:textStyle="bold" />


</LinearLayout>


</LinearLayout>


效果图



3.user_profile_mylove_collect.xml(第三个模块)




<?xml version="1.0" encoding="utf-8"?>


<LinearLayout


xmlns:android="http://schemas.android.com/apk/res/android"


android:background="@drawable/user_profile_background_like"


android:layout_height="@dimen/jimeng_dp_56"


android:layout_marginLeft="@dimen/jimeng_dp_16"


android:layout_marginRight="@dimen/jimeng_dp_16"


android:layout_width="fill_parent"


android:orientation="horizontal">


<RelativeLayout


android:id="@id/ll_owner_like"


android:layout_height="fill_parent"


android:layout_weight="1.0"


android:layout_width="wrap_content">


<ImageView

用户头像

Android架构

关注

还未添加个人签名 2021.10.31 加入

还未添加个人简介

评论

发布
暂无评论
Android企业级实战-界面篇-2